[Top][All Lists]

[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: Wed, 24 Aug 2011 18:44:19 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

> But I've found another use-case that seems to need a fix too:
> 0. C-s a <RET> C-s b <RET> C-s c <RET>
> 1. C-s C-s     --> "c" is selected, OK.
> 2. M-p <RET>   --> "b" is selected, OK.
> 3. M-p         --> Now "c" (the previous used entry) should have been
> selected, but I see that "b" (the current entry) remains selected
> instead.

This is a separate problem caused when exiting from the minibuffer in
`isearch-edit-string' by `read-from-minibuffer' (i.e. step 2
`M-p <RET>' above) adds a new element "b" to the history (search ring).

I agree that `isearch-edit-string' should not update the search ring.
It should be updated only by `isearch-update-ring' in `isearch-done'.
So e.g. `C-s C-s M-e RET C-g' or `C-s M-p RET C-g' should keep the
search ring unchanged.  Note also that `isearch-done' with the arg
NOPUSH=t already tries to take care of not updating the search ring,
but unsuccessfully.  It requires the following patch for the complete fix:

Using parent branch file:///home/work/emacs/bzr/emacs/http-trunk/
=== modified file 'lisp/isearch.el'
--- lisp/isearch.el     2011-07-15 13:33:07 +0000
+++ lisp/isearch.el     2011-08-24 15:43:01 +0000
@@ -1152,9 +1161,14 @@ (defun isearch-edit-string ()
              (let* ((message-log-max nil)
+                    ;; Protect the global search ring from updating
+                    ;; by read-from-minibuffer.  It should be updated only
+                    ;; by isearch-update-ring in isearch-done.
+                    (search-ring search-ring)
+                    (regexp-search-ring regexp-search-ring)
                     ;; Binding minibuffer-history-symbol to nil is a 
                     ;; for some incompatibility with gmhist.
                (setq isearch-new-string
                        (isearch-message-prefix nil nil isearch-nonincremental)
                        (cons isearch-string (1+ (isearch-fail-pos)))
                        minibuffer-local-isearch-map nil
                        (if isearch-regexp
                           (cons 'regexp-search-ring

reply via email to

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