emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105552: "C-s M-p" brings the tip of


From: Juri Linkov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105552: "C-s M-p" brings the tip of the search ring.
Date: Wed, 24 Aug 2011 12:40:58 +0300
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105552
fixes bug(s): http://debbugs.gnu.org/9185
committer: Juri Linkov <address@hidden>
branch nick: trunk
timestamp: Wed 2011-08-24 12:40:58 +0300
message:
  "C-s M-p" brings the tip of the search ring.
  
  * lisp/isearch.el (isearch-ring-adjust1): Start visiting previous
  search strings from the index 0 (-1 + 1) instead of 1 (0 + 1).
  (isearch-repeat, isearch-edit-string): Call `isearch-ring-adjust1'
  for empty search string (when the last search string is reused
  automatically) to adjust the isearch ring to the last element and
  prepare the correct index for further M-p commands.
modified:
  lisp/ChangeLog
  lisp/isearch.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-08-24 07:33:55 +0000
+++ b/lisp/ChangeLog    2011-08-24 09:40:58 +0000
@@ -1,3 +1,12 @@
+2011-08-24  Juri Linkov  <address@hidden>
+
+       * isearch.el (isearch-ring-adjust1): Start visiting previous
+       search strings from the index 0 (-1 + 1) instead of 1 (0 + 1).
+       (isearch-repeat, isearch-edit-string): Call `isearch-ring-adjust1'
+       for empty search string (when the last search string is reused
+       automatically) to adjust the isearch ring to the last element and
+       prepare the correct index for further M-p commands (bug#9185).
+
 2011-08-24  Kenichi Handa  <address@hidden>
 
        * international/ucs-normalize.el: If decomposition property of

=== modified file 'lisp/isearch.el'
--- a/lisp/isearch.el   2011-07-15 13:33:07 +0000
+++ b/lisp/isearch.el   2011-08-24 09:40:58 +0000
@@ -1191,19 +1191,17 @@
                  isearch-word isearch-new-word))
 
          ;; Empty isearch-string means use default.
-         (if (= 0 (length isearch-string))
-             (setq isearch-string (or (car (if isearch-regexp
-                                               regexp-search-ring
-                                             search-ring))
-                                      "")
+         (when (= 0 (length isearch-string))
+           (setq isearch-string (or (car (if isearch-regexp
+                                             regexp-search-ring
+                                           search-ring))
+                                    "")
 
-                   isearch-message
-                   (mapconcat 'isearch-text-char-description
-                              isearch-string ""))
-           ;; This used to set the last search string,
-           ;; but I think it is not right to do that here.
-           ;; Only the string actually used should be saved.
-           ))
+                 isearch-message
+                 (mapconcat 'isearch-text-char-description
+                            isearch-string ""))
+           ;; After taking the last element, adjust ring to previous one.
+           (isearch-ring-adjust1 nil)))
 
        ;; This used to push the state as of before this C-s, but it adds
        ;; an inconsistent state where part of variables are from the
@@ -1290,7 +1288,9 @@
                  isearch-message
                  (mapconcat 'isearch-text-char-description
                             isearch-string "")
-                 isearch-case-fold-search isearch-last-case-fold-search))
+                 isearch-case-fold-search isearch-last-case-fold-search)
+           ;; After taking the last element, adjust ring to previous one.
+           (isearch-ring-adjust1 nil))
        ;; If already have what to search for, repeat it.
        (or isearch-success
            (progn
@@ -2071,7 +2071,7 @@
        ()
       (set yank-pointer-name
           (setq yank-pointer
-                (mod (+ (or yank-pointer 0)
+                (mod (+ (or yank-pointer (if advance 0 -1))
                         (if advance -1 1))
                      length)))
       (setq isearch-string (nth yank-pointer ring)


reply via email to

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