GNU bug report logs -
#29821
eshell: Ensure quick substitution only occurs at start of line
Previous Next
Reported by: Jay Kamat <jaygkamat <at> gmail.com>
Date: Fri, 22 Dec 2017 23:58:02 UTC
Severity: normal
Tags: fixed
Fixed in version 27.1
Done: Noam Postavsky <npostavs <at> users.sourceforge.net>
Bug is archived. No further changes may be made.
Full log
Message #19 received at 29821 <at> debbugs.gnu.org (full text, mbox):
Andreas Schwab <schwab <at> linux-m68k.org> writes:
> On Dez 31 2017, Noam Postavsky <npostavs <at> users.sourceforge.net> wrote:
>
>> Hmm, using history expansion would mean typing
>>
>> M-p DEL C-a M-f M-d M-d ! ! : $
>>
>> to get
>>
>> mv !!:$ two.txt
>
> History expansion was invented when command line editing wasn't
> available, it typically makes only sense for entering a new command line
> (while referencing parts of the previous ones).
Yes, but I didn't want to handicap the history expansion case unfairly
by rejecting use of other history/editing commands.
Jay Kamat <jaygkamat <at> gmail.com> writes:
> I would much prefer a variable (perhaps defaulting to off) to tweak this
> setting on or of rather than adding/removing a function to the hook.
> Removing it in the current way makes it feel more 'deprecated' to me,
> rather than 'disabled by default'.
>
> Would you mind if I submitted a patch to add a new
> `eshell-history-expansion-enabled' variable (or similar)?
Seems like pointless duplication to me. I think I would prefer having
history expansion enabled by default to that (it wouldn't be that hard
to disable it, after all).
>> In eshell (with and without your patch) I get:
>>
>> ~/src/emacs $ echo foo bar
>> ("foo" "bar")
>> ~/src/emacs $ ^foo bar^blah^
>> ^foo: command not found
>
> I've attached a new patch which attempts to solve this as well. I'm
> unfamiliar with eshell internals though, so I'm not sure if it's done
> properly. Let me know if anyone sees any issues with it!
With your patch, if I do
~/src/emacs $ ^this string not present in history^blah^
I get the latest entry in the history substituted and re-executed. In
bash I get
~/tmp$ ^this string not present in history^blah^
bash: :s^this string not present in history^blah^: substitution failed
(if it's easier, I think it would be okay if eshell prints an error
using the !!:s/foo/bar/ syntax, but this case must be an error)
This bug report was last modified 7 years and 136 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.