[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#29821: Ensure quick substitution only occurs at start of line
From: |
Noam Postavsky |
Subject: |
bug#29821: Ensure quick substitution only occurs at start of line |
Date: |
Thu, 04 Jan 2018 20:04:09 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) |
Jay Kamat <jaygkamat@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)))
...
- bug#29821: Ensure quick substitution only occurs at start of line, Andreas Schwab, 2018/01/01
- bug#29821: Ensure quick substitution only occurs at start of line, Noam Postavsky, 2018/01/01
- bug#29821: Ensure quick substitution only occurs at start of line, Jay Kamat, 2018/01/01
- bug#29821: Ensure quick substitution only occurs at start of line, Noam Postavsky, 2018/01/01
- bug#29821: Ensure quick substitution only occurs at start of line, Jay Kamat, 2018/01/02
- bug#29821: Ensure quick substitution only occurs at start of line, Noam Postavsky, 2018/01/02
- bug#29821: Ensure quick substitution only occurs at start of line, Jay Kamat, 2018/01/03
- bug#29821: Ensure quick substitution only occurs at start of line, Noam Postavsky, 2018/01/03
- bug#29821: Ensure quick substitution only occurs at start of line, Jay Kamat, 2018/01/04
- bug#29821: Ensure quick substitution only occurs at start of line,
Noam Postavsky <=
- bug#29821: Ensure quick substitution only occurs at start of line, Jay Kamat, 2018/01/04
- bug#29821: Ensure quick substitution only occurs at start of line, Noam Postavsky, 2018/01/05