>     When isearch leaves the buffer in isearch mode (this can happen after
>     switching buffers during incremental search),
>
> I think that is the bug.  Isearch mode should not be left enabled.
>
> Can you debug that and fix it?

The simplest way to reproduce this is to evaluate:

(define-key isearch-mode-map "\M-m"
            (lambda () (interactive) (switch-to-buffer "*Messages*")))

and to type `C-s M-m a' in any buffer except the *Messages* buffer.

The first key activates search mode, the second key switches to the
*Messages* buffer, and the third key continues to search for `a' in
the *Messages* buffer with search mode still enabled.

After exiting the search in the *Messages* buffer and switching back
to the original buffer where the search was activated, the mode line
of the original buffer still displays the "Isearch" string and
isearch-mode is non-nil.

But perhaps this is just an improper key binding for isearch mode
and a valid way to duplicate a global keybinding in isearch mode is
to bind its key to `isearch-other-control-char':

;; existing global key binding:
(define-key global-map "\M-m"
            (lambda () (interactive) (switch-to-buffer "*Messages*")))

;; how to allow using the same key binding in isearch-mode:
(define-key isearch-mode-map "\M-m"
            'isearch-other-control-char)

This doesn't cause the reported problem.

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



_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

Reply via email to