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
View this message in rfc822 format
Jay Kamat <jaygkamat <at> gmail.com> writes:
> Ah, nice catch! I've updated the patch to handle that case as well. I've
> tested it as well as I could and it seems good to me, but in order to
> fix that case, I had to mess with the regexes a bit, so It's possible I
> might have missed a few cases.
There doesn't need to be trailing whitespace between the last "^" and
subsequent text, bash:
~/tmp$ echo foo bar
foo bar
~/tmp$ ^foo^blah^x
echo blah barx
blah barx
eshell (with your patch):
~/src/emacs $ echo foo bar
("foo" "bar")
~/src/emacs $ ^foo^blah^x
^foo^blah^x: command not found
And as far as I can tell, trailing whitespace should not be dropped
(though it's hard to come up with cases where it matters):
~/tmp$ echo 'foo bar '
foo bar
~/tmp$ ^bar^zz
echo 'foo zz '
foo zz
So I think this should do it?
...
(string-match
"^\\^\\([^^]+\\)\\^\\([^^]+\\)\\(?:\\^\\(.*\\)\\)?$"
line))
;; Save trailing match as `eshell-history-reference' runs string-match.
(let ((matched-end (match-string 3 line)))
...
This bug report was last modified 7 years and 137 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.