unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Desktop saves isearch-mode
@ 2005-10-17  8:05 Juri Linkov
  2005-10-17 21:57 ` Richard M. Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2005-10-17  8:05 UTC (permalink / raw)


When isearch leaves the buffer in isearch mode (this can happen after
switching buffers during incremental search), and desktop-mode is
enabled, it writes isearch-mode as one of buffer's minor modes to the
desktop file.

This causes bad effects during restoring the desktop.  When desktop.el
calls isearch-mode to restore file's minor modes, isearch-mode changes
the global value of `minibuffer-message-timeout' to nil.  Also it leaves
isearch-mode active globally.

A simple fix is to not write isearch-mode to the desktop file:

Index: lisp/desktop.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/desktop.el,v
retrieving revision 1.94
diff -c -r1.94 desktop.el
*** lisp/desktop.el	12 Oct 2005 09:16:35 -0000	1.94
--- lisp/desktop.el	17 Oct 2005 08:04:59 -0000
***************
*** 410,416 ****
  
  (defcustom desktop-minor-mode-table
    '((auto-fill-function auto-fill-mode)
!     (vc-mode nil))
    "Table mapping minor mode variables to minor mode functions.
  Each entry has the form (NAME RESTORE-FUNCTION).
  NAME is the name of the buffer-local variable indicating that the minor
--- 410,417 ----
  
  (defcustom desktop-minor-mode-table
    '((auto-fill-function auto-fill-mode)
!     (vc-mode nil)
!     (isearch-mode nil))
    "Table mapping minor mode variables to minor mode functions.
  Each entry has the form (NAME RESTORE-FUNCTION).
  NAME is the name of the buffer-local variable indicating that the minor

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Desktop saves isearch-mode
  2005-10-17  8:05 Desktop saves isearch-mode Juri Linkov
@ 2005-10-17 21:57 ` Richard M. Stallman
  2005-10-18  8:07   ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Richard M. Stallman @ 2005-10-17 21:57 UTC (permalink / raw)
  Cc: emacs-devel

    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?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Desktop saves isearch-mode
  2005-10-17 21:57 ` Richard M. Stallman
@ 2005-10-18  8:07   ` Juri Linkov
  2005-10-19  2:43     ` Richard M. Stallman
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2005-10-18  8:07 UTC (permalink / raw)
  Cc: emacs-devel

>     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/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Desktop saves isearch-mode
  2005-10-18  8:07   ` Juri Linkov
@ 2005-10-19  2:43     ` Richard M. Stallman
  2005-10-19 15:54       ` Juri Linkov
  0 siblings, 1 reply; 5+ messages in thread
From: Richard M. Stallman @ 2005-10-19  2:43 UTC (permalink / raw)
  Cc: emacs-devel

    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.

What this shows is that it is wrong to do `switch-to-buffer'
in an isearch without frobbing the modes in the buffers.

Where in the existing code of Isearch does it switch buffers
without frobbing the Isearch mode in the two buffers?
That place needs to be changed to turn of Isearch mode
in the old buffer.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Desktop saves isearch-mode
  2005-10-19  2:43     ` Richard M. Stallman
@ 2005-10-19 15:54       ` Juri Linkov
  0 siblings, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2005-10-19 15:54 UTC (permalink / raw)
  Cc: emacs-devel

> Where in the existing code of Isearch does it switch buffers
> without frobbing the Isearch mode in the two buffers?
> That place needs to be changed to turn of Isearch mode
> in the old buffer.

This code is in my .emacs.  I intended to take measures for the case
when someone else does the same in .emacs.  But it seems there is no need.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-19 15:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-17  8:05 Desktop saves isearch-mode Juri Linkov
2005-10-17 21:57 ` Richard M. Stallman
2005-10-18  8:07   ` Juri Linkov
2005-10-19  2:43     ` Richard M. Stallman
2005-10-19 15:54       ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).