emacs-devel
[Top][All Lists]
Advanced

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

isearch-push-state (was: First two elements of search-ring shown twice i


From: Juri Linkov
Subject: isearch-push-state (was: First two elements of search-ring shown twice in minibuffer when using M-p multiple times?)
Date: Mon, 10 Mar 2008 19:59:57 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-unknown-linux-gnu)

The recent change that highlights the failed part of the search
string helped to discover the following bug: typing `C-s M-e foo C-s'
(where `foo' is a string that doesn't exist in the current buffer)
doesn't highlight the failed search string in the isearch-fail face
after exiting from the edit-string minibuffer.

This is because `isearch-edit-string' puts the wrong search state
to the search status stack.  It calls `isearch-push-state' that
stores the new search string (that will fail to find) and the old
successfull state to `isearch-cmds'.

There are two calls of `isearch-push-state' in `isearch-edit-string'
and I think the first one is unnecessary because the state before M-e
is already recorded on the stack.

I also discovered another bug that the ring advancing command M-p puts
one unnecessary search state to the search status stack, but this is
only necessary when `search-ring-update' is non-nil.  Otherwise,
`isearch-edit-string' already has the call to `isearch-push-state'.

I tried different test cases and see no possible scenario that there
the following patch would fail:

Index: lisp/isearch.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/isearch.el,v
retrieving revision 1.313
diff -c -r1.313 isearch.el
*** lisp/isearch.el     28 Feb 2008 01:57:42 -0000      1.313
--- lisp/isearch.el     10 Mar 2008 17:56:09 -0000
***************
*** 1096,1104 ****
            ;; Only the string actually used should be saved.
            ))
  
-       ;; Push the state as of before this C-s.
-       (isearch-push-state)
- 
        ;; Reinvoke the pending search.
        (isearch-search)
        (isearch-push-state)
--- 1081,1086 ----
***************
*** 1895,1904 ****
    (if search-ring-update
        (progn
        (isearch-search)
        (isearch-update))
!     (isearch-edit-string)
!     )
!   (isearch-push-state))
  
  (defun isearch-ring-advance ()
    "Advance to the next search string in the ring."
--- 1887,1895 ----
    (if search-ring-update
        (progn
        (isearch-search)
+       (isearch-push-state)
        (isearch-update))
!     (isearch-edit-string)))
  
  (defun isearch-ring-advance ()
    "Advance to the next search string in the ring."

-- 
Juri Linkov
http://www.jurta.org/emacs/




reply via email to

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