unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
To: Dani Moncayo <dmoncayo@gmail.com>
Cc: 9185@debbugs.gnu.org
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	[thread overview]
Message-ID: <87aaaxq35c.fsf@mail.jurta.org> (raw)
In-Reply-To: <CAH8Pv0jTE+TXc8+BtUx71PnmQaT7xQsf9n4HMoXK2=TU2TBPzg@mail.gmail.com> (Dani Moncayo's message of "Thu, 25 Aug 2011 01:54:39 +0200")

> 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	other threads:[~2011-08-25  9:01 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-28  8:12 bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring Dani Moncayo
2011-07-28  8:18 ` Dani Moncayo
2011-07-28  8:20   ` Deniz Dogan
2011-07-28  8:43     ` Dani Moncayo
2011-07-28  8:50       ` Deniz Dogan
2011-07-28  9:08         ` Dani Moncayo
2011-07-28  9:11           ` Deniz Dogan
2011-07-28  9:17             ` Dani Moncayo
2011-07-28  9:11         ` Andreas Schwab
2011-07-28  9:29 ` Juri Linkov
2011-07-28  9:50   ` Juri Linkov
2011-07-28 10:05     ` Dani Moncayo
2011-07-28 11:13       ` Andreas Schwab
2011-07-28 11:32         ` Dani Moncayo
2011-07-28 11:44           ` Juri Linkov
2011-07-30  8:52           ` Juri Linkov
2011-08-10 19:03             ` Dani Moncayo
2011-08-13 15:24             ` Stefan Monnier
2011-08-14 11:14               ` Dani Moncayo
2011-08-14 12:36                 ` Stefan Monnier
2011-08-14 14:47                   ` Dani Moncayo
2011-08-21 17:56                     ` Dani Moncayo
2011-08-21 18:35                       ` Juri Linkov
2011-08-21 19:24                         ` Dani Moncayo
2011-08-22 11:06                           ` Juri Linkov
2011-08-22 12:09                             ` Dani Moncayo
2011-08-22 21:34                               ` Stefan Monnier
2011-08-23  9:52                                 ` Juri Linkov
2011-08-23 18:40                                   ` Stefan Monnier
2011-08-24  9:41                                     ` Juri Linkov
2011-08-24 14:23                                     ` Dani Moncayo
2011-08-24 15:44                                       ` Juri Linkov
2011-08-24 16:18                                         ` Dani Moncayo
2011-08-24 18:28                                           ` Juri Linkov
2011-08-24 23:21                                             ` Dani Moncayo
2011-08-24 23:54                                               ` Dani Moncayo
2011-08-25  9:01                                                 ` Juri Linkov [this message]
2011-08-25 10:10                                                   ` Dani Moncayo
2011-11-19 19:59                                         ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87aaaxq35c.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=9185@debbugs.gnu.org \
    --cc=dmoncayo@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).