GNU bug report logs - #29763
New Feature: Remove unneeded eval-expression in minibuffer-history

Previous Next

Package: emacs;

Reported by: rswgnu <at> gmail.com

Date: Mon, 18 Dec 2017 04:15:01 UTC

Severity: wishlist

Tags: patch

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

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 29763 in the body.
You can then email your comments to 29763 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#29763; Package emacs. (Mon, 18 Dec 2017 04:15:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to rswgnu <at> gmail.com:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 18 Dec 2017 04:15:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Robert Weiner <rsw <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: New Feature: Remove unneeded eval-expression in minibuffer-history
Date: Sun, 17 Dec 2017 23:13:17 -0500
[Message part 1 (text/plain, inline)]
For as long as I can remember, I have wanted the minibuffer history to
strip the eval-expression wrapper around expressions that I enter by
invoking eval-expression with M-:.  I want this because the wrapper
adds a lot of visual noise when searching for a specific expression and
makes it much harder to edit the expression and get trailing parentheses
right.

So if I enter:

  M-: (/ 1.0 9) RET

then C-x ESC ESC shows me:

  (eval-expression (quote (/ 1.0 9)) nil nil 127)

but I want to see just the expression that I want to reuse or edit:

  (/ 1.0 9)

This small patch against Emacs 27.0.50  gives me that; it does the same
removal for commands already in the history if you load the change in
the middle of an Emacs session.  Please consider adding it to Emacs; it is
already improving my productivity.

Bob
[Message part 2 (text/html, inline)]
[simple.el.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29763; Package emacs. (Mon, 18 Dec 2017 15:47:02 GMT) Full text and rfc822 format available.

Message #8 received at 29763 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rswgnu <at> gmail.com
Cc: 29763 <at> debbugs.gnu.org
Subject: Re: bug#29763: New Feature: Remove unneeded eval-expression in
 minibuffer-history
Date: Mon, 18 Dec 2017 17:46:32 +0200
> From: Robert Weiner <rsw <at> gnu.org>
> Date: Sun, 17 Dec 2017 23:13:17 -0500
> 
> For as long as I can remember, I have wanted the minibuffer history to
> strip the eval-expression wrapper around expressions that I enter by
> invoking eval-expression with M-:.  I want this because the wrapper
> adds a lot of visual noise when searching for a specific expression and
> makes it much harder to edit the expression and get trailing parentheses right.
> 
> So if I enter:
> 
>   M-: (/ 1.0 9) RET
> 
> then C-x ESC ESC shows me:
> 
>   (eval-expression (quote (/ 1.0 9)) nil nil 127)
> 
> but I want to see just the expression that I want to reuse or edit:
> 
>   (/ 1.0 9)

Hmm... why is this particular command (M-:) being singled out?  We
have a uniform behavior of "C-x ESC ESC" with all the commands: they
are stored and displayed as the equivalent Lisp expressions.  E.g.:

  C-x C-f ~/foo/bar RET
  C-x ESC ESC
     -| Redo: (find-file "~/foo/bar" t)

or even

  M-x set-variable RET auto-hscroll-mode RER current-line RET
  Cx ESC ESC
     -| Redo: (set-variable (quote auto-hscroll-mode) (quote current-line) nil)

Moreover, "M-x list-command-history" also shows the above expanded
forms.

One could argue whether showing Lisp instead of something similar to
what the user actually typed is a good idea, whether it's educational
or not, but this is very old and consistent behavior.  If we are going
to change that, I think the change should affect more than just M-:,
and should probably be an optional feature.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29763; Package emacs. (Mon, 18 Dec 2017 23:06:02 GMT) Full text and rfc822 format available.

Message #11 received at 29763 <at> debbugs.gnu.org (full text, mbox):

From: Robert Weiner <rsw <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 29763 <at> debbugs.gnu.org
Subject: Re: bug#29763: New Feature: Remove unneeded eval-expression in
 minibuffer-history
Date: Mon, 18 Dec 2017 18:04:18 -0500
[Message part 1 (text/plain, inline)]
On Mon, Dec 18, 2017 at 10:46 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Robert Weiner <rsw <at> gnu.org>
> > Date: Sun, 17 Dec 2017 23:13:17 -0500
> >
> > For as long as I can remember, I have wanted the minibuffer history to
> > strip the eval-expression wrapper around expressions that I enter by
> > invoking eval-expression with M-:.  I want this because the wrapper
> > adds a lot of visual noise when searching for a specific expression and
> > makes it much harder to edit the expression and get trailing parentheses
> right.
> >
> > So if I enter:
> >
> >   M-: (/ 1.0 9) RET
> >
> > then C-x ESC ESC shows me:
> >
> >   (eval-expression (quote (/ 1.0 9)) nil nil 127)
> >
> > but I want to see just the expression that I want to reuse or edit:
> >
> >   (/ 1.0 9)
>
> Hmm... why is this particular command (M-:) being singled out?


​Because if you remove the eval-expression wrapper, it still evaluate
to the same thing.  That is not the case for most other commands as
you can see from the examples you provided.

I did, however, imagine that other forms might be added to the
one function that pairs a command down and we could make it a variable
activated with a funcall if desired.
​​​

> ​​
> We
> ​
> ​​
> have a uniform behavior of "C-x ESC ESC" with all the commands

​​
​I figured that would come up.  ​Redo behavior won't change,
just whether a full command or an Lisp form is displayed.

I should note that someone pointed out that {M-: M-p} does
what I want already, so one option is to retrain the muscle
memory to that key, though that does not help with use of
list-command-history as discussed below.


> ​​
> ​​
> Moreover, "M-x list-command-history" also shows the above expanded
> ​​
> forms.
>

​Right, when looking through a list-command-history, it would
be much faster to find expressions without the wrapper even
though now they would just be forms and not commands.  Since
the redo code already does an eval of each element​, it won't
matter at that point.

​​
> One could argue whether showing Lisp instead of something similar to
> ​​
> what the user actually typed is a good idea, whether it's educational
> ​​
> or not, but this is very old and consistent behavior.  If we are going
> ​​
> to change that, I think the change should affect more than just M-:,
> ​​
> and should probably be an optional feature.
>

​I agree with that.  Think about it and decide whether such
a change would likely make it acceptable for merging.  If so,
we can make more edits, if not, we should drop it.

Bob
​
​​
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29763; Package emacs. (Fri, 22 Dec 2017 10:29:02 GMT) Full text and rfc822 format available.

Message #14 received at 29763 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: rswgnu <at> gmail.com
Cc: 29763 <at> debbugs.gnu.org
Subject: Re: bug#29763: New Feature: Remove unneeded eval-expression in
 minibuffer-history
Date: Fri, 22 Dec 2017 12:28:46 +0200
> From: Robert Weiner <rsw <at> gnu.org>
> Date: Mon, 18 Dec 2017 18:04:18 -0500
> Cc: 29763 <at> debbugs.gnu.org
> 
>  ​​One could argue whether showing Lisp instead of something similar to
>  ​​what the user actually typed is a good idea, whether it's educational
>  ​​or not, but this is very old and consistent behavior.  If we are going
>  ​​to change that, I think the change should affect more than just M-:,
>  ​​and should probably be an optional feature.
> 
> ​I agree with that.  Think about it and decide whether such
> a change would likely make it acceptable for merging.  If so,
> we can make more edits, if not, we should drop it.

IMO, such an option could be useful, but I'm puzzled by the lack of
any comments from others.  Not sure what does that mean.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29763; Package emacs. (Fri, 22 Dec 2017 12:17:02 GMT) Full text and rfc822 format available.

Message #17 received at 29763 <at> debbugs.gnu.org (full text, mbox):

From: Tomas Nordin <tomasn <at> posteo.net>
To: rswgnu <at> gmail.com, 29763 <at> debbugs.gnu.org
Subject: Re: bug#29763: New Feature: Remove unneeded eval-expression in
 minibuffer-history
Date: Fri, 22 Dec 2017 13:16:07 +0100
Robert Weiner <rsw <at> gnu.org> writes:

> For as long as I can remember, I have wanted the minibuffer history to
> strip the eval-expression wrapper around expressions that I enter by
> invoking eval-expression with M-:.  I want this because the wrapper
> adds a lot of visual noise when searching for a specific expression and
> makes it much harder to edit the expression and get trailing parentheses
> right.
>
> So if I enter:
>
>   M-: (/ 1.0 9) RET
>
> then C-x ESC ESC shows me:
>
>   (eval-expression (quote (/ 1.0 9)) nil nil 127)
>
> but I want to see just the expression that I want to reuse or edit:
>
>   (/ 1.0 9)

As a user I can easily agree on this idea.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29763; Package emacs. (Fri, 22 Dec 2017 13:00:02 GMT) Full text and rfc822 format available.

Message #20 received at 29763 <at> debbugs.gnu.org (full text, mbox):

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Robert Weiner <rsw <at> gnu.org>
Cc: rswgnu <at> gmail.com, 29763 <at> debbugs.gnu.org
Subject: Re: bug#29763: New Feature: Remove unneeded eval-expression in
 minibuffer-history
Date: Fri, 22 Dec 2017 13:58:49 +0100
On Dez 17 2017, Robert Weiner <rsw <at> gnu.org> wrote:

> + (defun minibuffer-history-edit-element (elt)
> +   "Automatically simplify ELT if possible, e.g. removing eval-expression."
> +   (or (and (consp elt) (eq (car elt) 'eval-expression)
> + 	   ;; Remove eval-expression wrapper and leave just the expression.
> + 	   (cadadr elt))

That mishandles self-evaluating expressions, they are not wrapped with
quote.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29763; Package emacs. (Fri, 22 Dec 2017 14:23:02 GMT) Full text and rfc822 format available.

Message #23 received at 29763 <at> debbugs.gnu.org (full text, mbox):

From: Robert Weiner <rsw <at> gnu.org>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 29763 <at> debbugs.gnu.org
Subject: Re: bug#29763: New Feature: Remove unneeded eval-expression in
 minibuffer-history
Date: Fri, 22 Dec 2017 09:21:38 -0500
[Message part 1 (text/plain, inline)]
On Fri, Dec 22, 2017 at 7:58 AM, Andreas Schwab <schwab <at> linux-m68k.org>
wrote:

> On Dez 17 2017, Robert Weiner <rsw <at> gnu.org> wrote:
>
> > + (defun minibuffer-history-edit-element (elt)
> > +   "Automatically simplify ELT if possible, e.g. removing
> eval-expression."
> > +   (or (and (consp elt) (eq (car elt) 'eval-expression)
> > +        ;; Remove eval-expression wrapper and leave just the expression.
> > +        (cadadr elt))
>
> That mishandles self-evaluating expressions, they are not wrapped with
> quote.
>

​You are correct.  This version resolves that issue and changes
repeat-complex-command to use eval-expression instead of
funcall-interactively to handle expressions rather than function
calls, including properly redoing:

   (quote emacs-version)

for example.

See attached.

Bob
[Message part 2 (text/html, inline)]
[simple.el.patch (application/octet-stream, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29763; Package emacs. (Mon, 24 Jun 2019 20:26:02 GMT) Full text and rfc822 format available.

Message #26 received at 29763 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: rswgnu <at> gmail.com, 29763 <at> debbugs.gnu.org
Subject: Re: bug#29763: New Feature: Remove unneeded eval-expression in
 minibuffer-history
Date: Mon, 24 Jun 2019 22:25:07 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>>  ​​One could argue whether showing Lisp instead of something similar to
>>  ​​what the user actually typed is a good idea, whether it's educational
>>  ​​or not, but this is very old and consistent behavior.  If we are going
>>  ​​to change that, I think the change should affect more than just M-:,
>>  ​​and should probably be an optional feature.
>> 
>> ​I agree with that.  Think about it and decide whether such
>> a change would likely make it acceptable for merging.  If so,
>> we can make more edits, if not, we should drop it.
>
> IMO, such an option could be useful, but I'm puzzled by the lack of
> any comments from others.  Not sure what does that mean.

Me neither, but I'm not very enthusiastic about the idea.  It's kinda
nice that C-x ESC ESC gives you the unvarnished truth...  and I just
think it's kinda odd to use C-x ESC ESC on `M-:' at all: It's fewer
keystrokes to say `M-: M-p'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#29763; Package emacs. (Thu, 27 Jun 2019 02:30:02 GMT) Full text and rfc822 format available.

Message #29 received at 29763 <at> debbugs.gnu.org (full text, mbox):

From: Robert Weiner <rswgnu <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 29763 <at> debbugs.gnu.org
Subject: Re: bug#29763: New Feature: Remove unneeded eval-expression in
 minibuffer-history
Date: Wed, 26 Jun 2019 22:29:10 -0400
I did not know about M-: M-p and have muscle memory that drives me to press C-x ESC ESC.  I will have to retrain a bit.  You can close this issue.

-- Bob

> On Jun 24, 2019, at 4:25 PM, Lars Ingebrigtsen <larsi <at> gnus.org> wrote:
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
>>> ​​One could argue whether showing Lisp instead of something similar to
>>> ​​what the user actually typed is a good idea, whether it's educational
>>> ​​or not, but this is very old and consistent behavior.  If we are going
>>> ​​to change that, I think the change should affect more than just M-:,
>>> ​​and should probably be an optional feature.
>>> 
>>> ​I agree with that.  Think about it and decide whether such
>>> a change would likely make it acceptable for merging.  If so,
>>> we can make more edits, if not, we should drop it.
>> 
>> IMO, such an option could be useful, but I'm puzzled by the lack of
>> any comments from others.  Not sure what does that mean.
> 
> Me neither, but I'm not very enthusiastic about the idea.  It's kinda
> nice that C-x ESC ESC gives you the unvarnished truth...  and I just
> think it's kinda odd to use C-x ESC ESC on `M-:' at all: It's fewer
> keystrokes to say `M-: M-p'.
> 
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>   bloggy blog: http://lars.ingebrigtsen.no




bug closed, send any further explanations to 29763 <at> debbugs.gnu.org and rswgnu <at> gmail.com Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 27 Jun 2019 10:27:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 25 Jul 2019 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 270 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.