aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2011-08-24 12:40:58 +0300
committerJuri Linkov2011-08-24 12:40:58 +0300
commit11dcdbb283eb9efddf73939d3c3d12404731833f (patch)
tree1a3b0f7e6ebed11057f00ed563247810f546e52a
parentf67cdd7f258347b3fe21fa3c8bfc335decad02d6 (diff)
downloademacs-11dcdbb283eb9efddf73939d3c3d12404731833f.tar.gz
emacs-11dcdbb283eb9efddf73939d3c3d12404731833f.zip
"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. Fixes: debbugs:9185
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/isearch.el30
2 files changed, 24 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2a33661c9c5..6716a879a76 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,12 @@
12011-08-24 Juri Linkov <juri@jurta.org>
2
3 * isearch.el (isearch-ring-adjust1): Start visiting previous
4 search strings from the index 0 (-1 + 1) instead of 1 (0 + 1).
5 (isearch-repeat, isearch-edit-string): Call `isearch-ring-adjust1'
6 for empty search string (when the last search string is reused
7 automatically) to adjust the isearch ring to the last element and
8 prepare the correct index for further M-p commands (bug#9185).
9
12011-08-24 Kenichi Handa <handa@m17n.org> 102011-08-24 Kenichi Handa <handa@m17n.org>
2 11
3 * international/ucs-normalize.el: If decomposition property of 12 * international/ucs-normalize.el: If decomposition property of
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 1942641fae9..7fcc31f188f 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1191,19 +1191,17 @@ If first char entered is \\[isearch-yank-word-or-char], then do word search inst
1191 isearch-word isearch-new-word)) 1191 isearch-word isearch-new-word))
1192 1192
1193 ;; Empty isearch-string means use default. 1193 ;; Empty isearch-string means use default.
1194 (if (= 0 (length isearch-string)) 1194 (when (= 0 (length isearch-string))
1195 (setq isearch-string (or (car (if isearch-regexp 1195 (setq isearch-string (or (car (if isearch-regexp
1196 regexp-search-ring 1196 regexp-search-ring
1197 search-ring)) 1197 search-ring))
1198 "") 1198 "")
1199 1199
1200 isearch-message 1200 isearch-message
1201 (mapconcat 'isearch-text-char-description 1201 (mapconcat 'isearch-text-char-description
1202 isearch-string "")) 1202 isearch-string ""))
1203 ;; This used to set the last search string, 1203 ;; After taking the last element, adjust ring to previous one.
1204 ;; but I think it is not right to do that here. 1204 (isearch-ring-adjust1 nil)))
1205 ;; Only the string actually used should be saved.
1206 ))
1207 1205
1208 ;; This used to push the state as of before this C-s, but it adds 1206 ;; This used to push the state as of before this C-s, but it adds
1209 ;; an inconsistent state where part of variables are from the 1207 ;; an inconsistent state where part of variables are from the
@@ -1290,7 +1288,9 @@ Use `isearch-exit' to quit without signaling."
1290 isearch-message 1288 isearch-message
1291 (mapconcat 'isearch-text-char-description 1289 (mapconcat 'isearch-text-char-description
1292 isearch-string "") 1290 isearch-string "")
1293 isearch-case-fold-search isearch-last-case-fold-search)) 1291 isearch-case-fold-search isearch-last-case-fold-search)
1292 ;; After taking the last element, adjust ring to previous one.
1293 (isearch-ring-adjust1 nil))
1294 ;; If already have what to search for, repeat it. 1294 ;; If already have what to search for, repeat it.
1295 (or isearch-success 1295 (or isearch-success
1296 (progn 1296 (progn
@@ -2071,7 +2071,7 @@ Isearch mode."
2071 () 2071 ()
2072 (set yank-pointer-name 2072 (set yank-pointer-name
2073 (setq yank-pointer 2073 (setq yank-pointer
2074 (mod (+ (or yank-pointer 0) 2074 (mod (+ (or yank-pointer (if advance 0 -1))
2075 (if advance -1 1)) 2075 (if advance -1 1))
2076 length))) 2076 length)))
2077 (setq isearch-string (nth yank-pointer ring) 2077 (setq isearch-string (nth yank-pointer ring)