bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring


From: Juri Linkov
Subject: bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring
Date: Thu, 25 Aug 2011 12:01:51 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

> 0. C-s a <RET> C-s b <RET> C-s c <RET>
> 1. C-s M-e <RET>    --> "c" is selected, OK [*].
> 2. M-p              --> Now "b" (the previous entry) should have been
> selected, but I see that "c" (the current entry) remains selected
> instead.

This can be easily fixed by moving `isearch-ring-adjust1' out of
let-binding of `search-ring-yank-pointer'.  But I think we should start
from the top of the search ring after `M-e RET' because we can't reliably
update the index.  See more below.

> [*] FWIW: This is indeed the current behavior (use the last entry if
> the minibuffer is empty), but I don't find it very suitable.  If the
> user wanted to use the last entry, s?he would have typed M-p.
> Therefore, IMO TRT here would be to return to Isearch with an empty
> string.

I suppose the last entry is used because otherwise an empty search
string makes no sense.  I have nothing against this functionality
because I never exit from the M-e minibuffer with empty input.

> Another failing use-case:
> 0. C-s a <RET> C-s b <RET> C-s c <RET> C-s d <RET>
> 1. C-s C-s        --> "d" is selected (ok).
> 2. M-p M-p <RET>  --> "b" is selected (ok).
> 3. M-p            --> "a" should have been selected, but I see that
> "b" remains selected instead.

We can't reliably count the number of typed M-p in `read-from-minibuffer'
in `isearch-edit-string' to adjust the index accordingly and to add the
same number of typed M-p to the index.  There is no reliable way to do this:
we could try to find the input string in the history (search ring) and
add its index to `search-ring-yank-pointer', but what to do when the user
types the same string that exists in the history - then the index
in the search ring will be incorrect.

Since `read-from-minibuffer' can't return the exact number of typed `M-p'
then I think that M-p after `M-e M-p M-p <RET>' should start from the
top of of the search ring, so `C-s C-s M-p M-p RET M-p' should select "d".
This will provide a predictable result.

OTOH, when `search-ring-update' is non-nil, `isearch-edit-string' is not used,
so everything works correctly.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]