GNU bug report logs -
#4118
23.1; eval-last-sexp-print-value is inconvenient
Previous Next
Reported by: Eli Barzilay <eli <at> barzilay.org>
Date: Tue, 11 Aug 2009 11:05:08 UTC
Severity: wishlist
Fixed in version 24.4
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4118 in the body.
You can then email your comments to 4118 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Tue, 11 Aug 2009 11:05:08 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Barzilay <eli <at> barzilay.org>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Tue, 11 Aug 2009 11:05:08 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:
`eval-last-sexp' is often useful with a prefix argument inside a
buffer for all kinds of programmatic uses (for example, make a
keyboard macro that massages some text into an S-expression, then
use it to plant the result in the buffer). This uses
`eval-last-sexp-print-value', which will "helpfully" insert other
junk into the buffer (the hex and the octal representations of the
number). This is cute to have on the echo area, but annoying for
such use in macros. It would be better to disable this extra output
in the case of non-echo-area output.
I have a rather simple solution -- redefine the
`eval-last-sexp-print-value' function with an extra condition
(let ((str (and (eq standard-output t) ; <--- HERE
(eval-expression-print-format value))))
(if str (princ str)))
which works reasonably well.
In GNU Emacs 23.1.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.10.14)
of 2009-08-01 on winooski.ccs.neu.edu
Windowing system distributor `The X.Org Foundation', version 11.0.10300000
configured using `configure '--prefix=/home/eli/bin/local/emacs-dir''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: POSIX
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US
value of $XMODIFIERS: nil
locale-coding-system: iso-latin-1-unix
default-enable-multibyte-characters: t
Major mode: Text
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
global-auto-composition-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
M-x r e p o <tab> r <tab> <return>
Recent messages:
Loading ~/MyEmacs/pre...done
Loading ~/EliEmacs/eliemacs...done
Loading ~/MyEmacs/post...done
Making completion list...
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Wed, 12 Aug 2009 23:15:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 12 Aug 2009 23:15:04 GMT)
Full text and
rfc822 format available.
Message #10 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
> `eval-last-sexp' is often useful with a prefix argument inside a
> buffer for all kinds of programmatic uses (for example, make a
> keyboard macro that massages some text into an S-expression, then
> use it to plant the result in the buffer). This uses
> `eval-last-sexp-print-value', which will "helpfully" insert other
> junk into the buffer (the hex and the octal representations of the
> number).
But it inserts other representations only when you type `C-x C-e' twice.
Do you mean you don't want this after the second `C-x C-e' key press?
> This is cute to have on the echo area, but annoying for
> such use in macros. It would be better to disable this extra output
> in the case of non-echo-area output.
Sometimes I use `C-x C-e C-u C-x C-e' to insert other representations
to the current buffer to be able to copy their values as text. Of course,
it's possible to copy them from the *Messages* buffer, but this is
less convenient.
--
Juri Linkov
http://www.jurta.org/emacs/
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Wed, 12 Aug 2009 23:15:08 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Wed, 12 Aug 2009 23:15:08 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Thu, 13 Aug 2009 01:25:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Barzilay <eli <at> barzilay.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Thu, 13 Aug 2009 01:25:05 GMT)
Full text and
rfc822 format available.
Message #20 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
On Aug 12, Juri Linkov wrote:
> > `eval-last-sexp' is often useful with a prefix argument inside a
> > buffer for all kinds of programmatic uses (for example, make a
> > keyboard macro that massages some text into an S-expression,
> > then use it to plant the result in the buffer). This uses
> > `eval-last-sexp-print-value', which will "helpfully" insert
> > other junk into the buffer (the hex and the octal
> > representations of the number).
>
> But it inserts other representations only when you type `C-x C-e' twice.
> Do you mean you don't want this after the second `C-x C-e' key press?
Hmm, I see that the reason for what I've seen is that I'm using it
indirectly through my own function, and for some reason
`eval-expression-print-format' decides whether to do its thing based
on the current command. This looks like an odd interface... A better
and more consistent interface seems to me to always print the extra
information unless it goes into a buffer -- something like:
(defun eval-expression-print-format (value)
...
(if (and (integerp value) (not (bufferp standard-output)))
...))
But you seem to suggest that there are practical uses to get that
extra stuff into the buffer? I don't see any occasion that would make
it desirable...
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Thu, 13 Aug 2009 01:25:06 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Barzilay <eli <at> barzilay.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Thu, 13 Aug 2009 01:25:07 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Thu, 13 Aug 2009 23:50:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Thu, 13 Aug 2009 23:50:04 GMT)
Full text and
rfc822 format available.
Message #30 received at 4118 <at> emacsbugs.donarmstrong.com (full text, mbox):
>> But it inserts other representations only when you type `C-x C-e' twice.
>> Do you mean you don't want this after the second `C-x C-e' key press?
>
> Hmm, I see that the reason for what I've seen is that I'm using it
> indirectly through my own function, and for some reason
> `eval-expression-print-format' decides whether to do its thing based
> on the current command. This looks like an odd interface... A better
> and more consistent interface seems to me to always print the extra
> information unless it goes into a buffer -- something like:
>
> (defun eval-expression-print-format (value)
> ...
> (if (and (integerp value) (not (bufferp standard-output)))
> ...))
The reason not to print the extra information on the first invocation of
`eval-last-sexp' is the following. Most often users want to see the integer
result of the evaluated expression, but the extra information also contains
a character representation of this integer that might print some unrelated
character that might load some weird fonts the user doesn't want to load.
> But you seem to suggest that there are practical uses to get that
> extra stuff into the buffer? I don't see any occasion that would make
> it desirable...
When the current buffer contains an integer, typing `C-x C-e' twice
inserts it to the same buffer as a character. However, this is
not too convenient, so I'd like to improve this interface.
--
Juri Linkov
http://www.jurta.org/emacs/
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Fri, 14 Aug 2009 01:30:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Barzilay <eli <at> barzilay.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Fri, 14 Aug 2009 01:30:03 GMT)
Full text and
rfc822 format available.
Message #35 received at 4118 <at> emacsbugs.donarmstrong.com (full text, mbox):
On Aug 14, Juri Linkov wrote:
> >> But it inserts other representations only when you type `C-x C-e' twice.
> >> Do you mean you don't want this after the second `C-x C-e' key press?
> >
> > Hmm, I see that the reason for what I've seen is that I'm using it
> > indirectly through my own function, and for some reason
> > `eval-expression-print-format' decides whether to do its thing based
> > on the current command. This looks like an odd interface... A better
> > and more consistent interface seems to me to always print the extra
> > information unless it goes into a buffer -- something like:
> >
> > (defun eval-expression-print-format (value)
> > ...
> > (if (and (integerp value) (not (bufferp standard-output)))
> > ...))
>
> The reason not to print the extra information on the first
> invocation of `eval-last-sexp' is the following. Most often users
> want to see the integer result of the evaluated expression, but the
> extra information also contains a character representation of this
> integer that might print some unrelated character that might load
> some weird fonts the user doesn't want to load.
In that case the obvious way to do this is to not print the character
form if it requires such a font. If this is not easy to do, then
making it work only for ASCII seems better than the current weird
behavior. (The reason I consider it weird is that I managed to use
Emacs for more than 15 years without noticing it.)
> > But you seem to suggest that there are practical uses to get that
> > extra stuff into the buffer? I don't see any occasion that would
> > make it desirable...
>
> When the current buffer contains an integer, typing `C-x C-e' twice
> inserts it to the same buffer as a character. However, this is not
> too convenient, so I'd like to improve this interface.
The main point (IMO) of making it consistent is keyboard macros, and
in that case, if you want the character, then it's easy to just wrap
an (insert ...) around the expression. Using it to insert the
character and then removing all the preceding text is much more
difficult for that.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Fri, 14 Aug 2009 23:30:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Fri, 14 Aug 2009 23:30:04 GMT)
Full text and
rfc822 format available.
Message #40 received at 4118 <at> emacsbugs.donarmstrong.com (full text, mbox):
>> The reason not to print the extra information on the first
>> invocation of `eval-last-sexp' is the following. Most often users
>> want to see the integer result of the evaluated expression, but the
>> extra information also contains a character representation of this
>> integer that might print some unrelated character that might load
>> some weird fonts the user doesn't want to load.
>
> In that case the obvious way to do this is to not print the character
> form if it requires such a font. If this is not easy to do, then
> making it work only for ASCII seems better than the current weird
> behavior. (The reason I consider it weird is that I managed to use
> Emacs for more than 15 years without noticing it.)
There is no way to guess whether the user want to see the character
(however weird it is) or not.
> The main point (IMO) of making it consistent is keyboard macros, and
> in that case, if you want the character, then it's easy to just wrap
> an (insert ...) around the expression. Using it to insert the
> character and then removing all the preceding text is much more
> difficult for that.
Wrapping an (insert ...) around the expression is not as easy as typing
`C-u C-x C-e', copying the character and undoing the change with C-/.
--
Juri Linkov
http://www.jurta.org/emacs/
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Sat, 15 Aug 2009 01:45:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Barzilay <eli <at> barzilay.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Sat, 15 Aug 2009 01:45:04 GMT)
Full text and
rfc822 format available.
Message #45 received at 4118 <at> emacsbugs.donarmstrong.com (full text, mbox):
On Aug 15, Juri Linkov wrote:
> >> The reason not to print the extra information on the first
> >> invocation of `eval-last-sexp' is the following. Most often users
> >> want to see the integer result of the evaluated expression, but the
> >> extra information also contains a character representation of this
> >> integer that might print some unrelated character that might load
> >> some weird fonts the user doesn't want to load.
> >
> > In that case the obvious way to do this is to not print the
> > character form if it requires such a font. If this is not easy to
> > do, then making it work only for ASCII seems better than the
> > current weird behavior. (The reason I consider it weird is that I
> > managed to use Emacs for more than 15 years without noticing it.)
>
> There is no way to guess whether the user want to see the character
> (however weird it is) or not.
The weird thing is not showing the character -- it is the fact that
the extra information is "sometimes there" -- it is the fact that the
behavior depends on whether the command was issued two times in a row.
> > The main point (IMO) of making it consistent is keyboard macros,
> > and in that case, if you want the character, then it's easy to
> > just wrap an (insert ...) around the expression. Using it to
> > insert the character and then removing all the preceding text is
> > much more difficult for that.
>
> Wrapping an (insert ...) around the expression is not as easy as
> typing `C-u C-x C-e', copying the character and undoing the change
> with C-/.
...and this is a good description for a solution: have it print out
the extra information only on something like an explicit positive
prefix argument (eg, C-u C-1 C-x C-e), and otherwise don't show it.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Sat, 15 Aug 2009 23:30:04 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Sat, 15 Aug 2009 23:30:05 GMT)
Full text and
rfc822 format available.
Message #50 received at 4118 <at> emacsbugs.donarmstrong.com (full text, mbox):
>> Wrapping an (insert ...) around the expression is not as easy as
>> typing `C-u C-x C-e', copying the character and undoing the change
>> with C-/.
>
> ...and this is a good description for a solution: have it print out
> the extra information only on something like an explicit positive
> prefix argument (eg, C-u C-1 C-x C-e), and otherwise don't show it.
And then the number could mean the verbosity level, e.g. `C-1 C-x C-e'
prints octal and hex, and `C-2 C-x C-e' prints octal, hex and a character.
But I don't see how to insert different representations to the current
buffer instead of displaying them in the echo area since `C-u C-1 C-x C-e'
and `C-1 C-x C-e' have the same numeric argument `1'.
--
Juri Linkov
http://www.jurta.org/emacs/
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Sun, 16 Aug 2009 00:05:10 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Barzilay <eli <at> barzilay.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Sun, 16 Aug 2009 00:05:10 GMT)
Full text and
rfc822 format available.
Message #55 received at 4118 <at> emacsbugs.donarmstrong.com (full text, mbox):
On Aug 16, Juri Linkov wrote:
> >> Wrapping an (insert ...) around the expression is not as easy as
> >> typing `C-u C-x C-e', copying the character and undoing the change
> >> with C-/.
> >
> > ...and this is a good description for a solution: have it print out
> > the extra information only on something like an explicit positive
> > prefix argument (eg, C-u C-1 C-x C-e), and otherwise don't show it.
>
> And then the number could mean the verbosity level, e.g. `C-1 C-x
> C-e' prints octal and hex, and `C-2 C-x C-e' prints octal, hex and a
> character.
Cute idea,
> But I don't see how to insert different representations to the
> current buffer instead of displaying them in the echo area since
> `C-u C-1 C-x C-e' and `C-1 C-x C-e' have the same numeric argument
> `1'.
but yes, that won't work as is. It could work as a verbosity level
indicator for insertion into the buffer, and echo-area messages could
still do the different output based on the number of times it was
called. The echo area messages won't be consistent but that's not as
important. And negative prefixes could be used for those rare cases
where you want the verbose output into the echo area. Something like
this:
A prefix of
1 (or just C-u) -> output a plain number into the buffer
2 -> number + alternative radix outputs into the buffer
3 -> number + alternates + character into the buffer
-1, -2, -3 -> same as above, but for the echo area
And the above always behaves the same.
*No* prefix means:
show the plain number output in the echo area on first use
number + alternates on second use (with no prefix, of course)
number + alternates + character on the third use.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
Severity set to `wishlist' from `normal'
Request was from
Chong Yidong <cyd <at> stupidchicken.com>
to
control <at> emacsbugs.donarmstrong.com
.
(Sun, 16 Aug 2009 15:00:09 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Mon, 17 Aug 2009 01:35:05 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Juri Linkov <juri <at> jurta.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Mon, 17 Aug 2009 01:35:05 GMT)
Full text and
rfc822 format available.
Message #62 received at 4118 <at> emacsbugs.donarmstrong.com (full text, mbox):
> A prefix of
> 1 (or just C-u) -> output a plain number into the buffer
> 2 -> number + alternative radix outputs into the buffer
> 3 -> number + alternates + character into the buffer
> -1, -2, -3 -> same as above, but for the echo area
> And the above always behaves the same.
>
> *No* prefix means:
> show the plain number output in the echo area on first use
> number + alternates on second use (with no prefix, of course)
> number + alternates + character on the third use.
Then maybe the same scheme should be applied to `eval-expression'
(`M-:') as well.
--
Juri Linkov
http://www.jurta.org/emacs/
Information forwarded
to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#4118
; Package
emacs
.
(Mon, 17 Aug 2009 03:25:07 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Eli Barzilay <eli <at> barzilay.org>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
(Mon, 17 Aug 2009 03:25:07 GMT)
Full text and
rfc822 format available.
Message #67 received at 4118 <at> emacsbugs.donarmstrong.com (full text, mbox):
On Aug 17, Juri Linkov wrote:
> > A prefix of
> > 1 (or just C-u) -> output a plain number into the buffer
> > 2 -> number + alternative radix outputs into the buffer
> > 3 -> number + alternates + character into the buffer
> > -1, -2, -3 -> same as above, but for the echo area
> > And the above always behaves the same.
> >
> > *No* prefix means:
> > show the plain number output in the echo area on first use
> > number + alternates on second use (with no prefix, of course)
> > number + alternates + character on the third use.
>
> Then maybe the same scheme should be applied to `eval-expression'
> (`M-:') as well.
Yes, that sounds good to me.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!
Reply sent
to
Noam Postavsky <npostavs <at> users.sourceforge.net>
:
You have taken responsibility.
(Wed, 15 Jun 2016 00:37:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Eli Barzilay <eli <at> barzilay.org>
:
bug acknowledged by developer.
(Wed, 15 Jun 2016 00:37:02 GMT)
Full text and
rfc822 format available.
Message #72 received at 4118-done <at> debbugs.gnu.org (full text, mbox):
Version: 24.4
This was fixed along with #12985 by b41594fd (Thu Dec 19 23:02:46 2013 +0200)
"* lisp/simple.el (eval-expression-print-format): Don't check for
command names and the last command. Always display additional
formats of the integer result in the echo area, and insert them
to the current buffer only with a zero prefix arg.
Display character when char-displayable-p is non-nil.
(eval-expression): With a zero prefix arg, set `print-length' and
`print-level' to nil, and insert the integer values from
`eval-expression-print-format' at the end. Doc fix.
[...]"
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 13 Jul 2016 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 38 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.