[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 21:28:09 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu)

> However, on further testing, I've found still another misbehavior:
> 0. C-s a <RET> C-s b <RET> C-s c <RET>
> 1. C-s C-s     --> "c" is selected, OK.
> 2. M-e <RET>   --> "c" remains selected (the search ring is unchanged:
> "a;b;c"), OK.
> 3. M-p         --> Now "b" (the previous used entry) should have been
> selected, but I see that "c" (the current entry) remains selected
> instead.

So you are asking that after `isearch-edit-string' indexes of the
search ring should remain unchanged.  This is accomplished by this patch:

=== modified file 'lisp/isearch.el'
--- lisp/isearch.el     2011-07-15 13:33:07 +0000
+++ lisp/isearch.el     2011-08-24 18:27:33 +0000
@@ -1131,6 +1140,9 @@ (defun isearch-edit-string ()
              (isearch-recursive-edit isearch-recursive-edit)
              ;; Save current configuration so we can restore it here.
              (isearch-window-configuration (current-window-configuration))
+             ;; Save index of the search ring.
+             (search-ring-yank-pointer search-ring-yank-pointer)
+             (regexp-search-ring-yank-pointer regexp-search-ring-yank-pointer)
              ;; Temporarily restore `minibuffer-message-timeout'.
@@ -1152,9 +1164,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]