summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-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 @@
+2011-08-24 Juri Linkov <juri@jurta.org>
+
+ * 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 <handa@m17n.org>
* 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
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))
- "")
-
- 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.
- ))
+ (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 ""))
+ ;; 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 @@ Use `isearch-exit' to quit without signaling."
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 @@ Isearch mode."
()
(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)