]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/isearch.el (isearch-edit-string): Let-bind `search-ring' and
authorJuri Linkov <juri@jurta.org>
Thu, 25 Aug 2011 20:32:54 +0000 (23:32 +0300)
committerJuri Linkov <juri@jurta.org>
Thu, 25 Aug 2011 20:32:54 +0000 (23:32 +0300)
`regexp-search-ring' to their global values to protect from
updating by `read-from-minibuffer'.

Fixes: debbugs:9185
lisp/ChangeLog
lisp/isearch.el

index a98bdfd7709dee1547a85a14d19120692c305248..b1d04b8c1b6b2b87f6a403bac81014732e7a7358 100644 (file)
@@ -1,3 +1,9 @@
+2011-08-25  Juri Linkov  <juri@jurta.org>
+
+       * isearch.el (isearch-edit-string): Let-bind `search-ring' and
+       `regexp-search-ring' to their global values to protect from
+       updating by `read-from-minibuffer' (bug#9185).
+
 2011-08-25  Juri Linkov  <juri@jurta.org>
 
        * textmodes/ispell.el (ispell-command-loop): Add newline
index 7fcc31f188f844815bc1e8dca23e670990e1ce3f..12529857a2c94d44d281171d7a3a913a6dd77049 100644 (file)
@@ -1132,6 +1132,14 @@ If first char entered is \\[isearch-yank-word-or-char], then do word search inst
              ;; Save current configuration so we can restore it here.
              (isearch-window-configuration (current-window-configuration))
 
+             ;; This could protect the index of the search rings,
+             ;; but we can't reliably count the number of typed M-p
+             ;; in `read-from-minibuffer' to adjust the index accordingly.
+             ;; So when the following is commented out, `isearch-mode'
+             ;; below resets the index to the predictable value nil.
+             ;; (search-ring-yank-pointer search-ring-yank-pointer)
+             ;; (regexp-search-ring-yank-pointer regexp-search-ring-yank-pointer)
+
              ;; Temporarily restore `minibuffer-message-timeout'.
              (minibuffer-message-timeout
               isearch-original-minibuffer-message-timeout)
@@ -1152,13 +1160,18 @@ If first char entered is \\[isearch-yank-word-or-char], then do word search inst
 
          (unwind-protect
              (let* ((message-log-max nil)
+                    ;; Protect global value of search rings from updating
+                    ;; by `read-from-minibuffer'.  It should be updated only
+                    ;; by `isearch-update-ring' in `isearch-done', not here.
+                    (search-ring search-ring)
+                    (regexp-search-ring regexp-search-ring)
                     ;; Binding minibuffer-history-symbol to nil is a work-around
                     ;; for some incompatibility with gmhist.
                     (minibuffer-history-symbol))
                (setq isearch-new-string
                       (read-from-minibuffer
                        (isearch-message-prefix nil nil isearch-nonincremental)
-                        (cons isearch-string (1+ (isearch-fail-pos)))
+                      (cons isearch-string (1+ (isearch-fail-pos)))
                        minibuffer-local-isearch-map nil
                        (if isearch-regexp
                           (cons 'regexp-search-ring