[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: |
Tue, 23 Aug 2011 12:52:57 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (x86_64-pc-linux-gnu) |
> A patch that makes it work like you describe (i.e. C-s M-p gets first,
> and C-s C-s M-p gets the second) sounds OK, assuming the patch
> is not too ugly.
There are two places in isearch.el that reuse the last element of the
ring when the search string is empty. One is `isearch-repeat' (used by
`C-s C-s') and another is `isearch-edit-string'. The latter is questionable.
An old comment used to say:
;; 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.
It doesn't correspond to the actual code, so I deleted it.
I have no opinion how useless is to reuse the last element of the
ring after exiting from `isearch-edit-string' with empty input.
But with the existing functionality this place needs to adjust the ring.
So three diff hunks below fix the following cases:
1. in isearch-edit-string: C-s M-e RET M-p
2. in isearch-repeat: C-s C-s M-p
3. in isearch-ring-adjust1: C-s M-p
=== modified file 'lisp/isearch.el'
--- lisp/isearch.el 2011-07-15 13:33:07 +0000
+++ lisp/isearch.el 2011-08-23 09:51:16 +0000
@@ -1191,19 +1200,17 @@ (defun isearch-edit-string ()
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 +1297,9 @@ (defun isearch-repeat (direction)
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 +2080,7 @@ (defun isearch-ring-adjust1 (advance)
()
(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)
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, (continued)
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Stefan Monnier, 2011/08/13
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/14
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Stefan Monnier, 2011/08/14
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/14
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/21
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Juri Linkov, 2011/08/21
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/21
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Juri Linkov, 2011/08/22
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/22
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Stefan Monnier, 2011/08/22
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring,
Juri Linkov <=
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Stefan Monnier, 2011/08/23
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Juri Linkov, 2011/08/24
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/24
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Juri Linkov, 2011/08/24
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/24
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Juri Linkov, 2011/08/24
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/24
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/24
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Juri Linkov, 2011/08/25
- bug#9185: 24.0.50; "C-s M-p" does not bring the tip of the search ring, Dani Moncayo, 2011/08/25