[Top][All Lists]

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

bug#11304: mouse-autoselect-window causes loss of messages from echo are

From: martin rudalics
Subject: bug#11304: mouse-autoselect-window causes loss of messages from echo area
Date: Sun, 22 Apr 2012 14:29:51 +0200

> Steps to reproduce the bug (or maybe it's an intentional feature, but if so, 
I don't see the purpose):
> Put just the following in your .emacs file:
> (setq mouse-autoselect-window t)
> Start Emacs with no options.
> Press C-g.
> Move your mouse pointer across the echo area. Emacs erases "Quit". The 
desired behavior is to not erase the text; I routinely inadvertently move the pointer across 
the echo area when moving the pointer to another window (of the window manager, not of 
Emacs), and when I go back to Emacs, I then have to switch to *Messages* to see what the 
last message was, rather than just looking at the echo area. Disabling 
mouse-autoselect-window to avoid the bug isn't an option; the feature is too useful.

We can fix this via the attached patch.  It changes behavior in the
sense that it doesn't run `echo-area-clear-hook' any more for
select-window events.  But if this hook is important it should probably
be run by (message nil) and (message "") anyway.

=== modified file 'lisp/window.el'
--- lisp/window.el      2012-04-20 08:48:50 +0000
+++ lisp/window.el      2012-04-22 12:11:50 +0000
@@ -5727,6 +5727,8 @@
        (setq mouse-autoselect-window-state nil)
        ;; Run `mouse-leave-buffer-hook' when autoselecting window.
        (run-hooks 'mouse-leave-buffer-hook))
+      ;; Clear echo area.
+      (message nil)
       (select-window window))))
 (defun truncated-partial-width-window-p (&optional window)

=== modified file 'src/keyboard.c'
--- src/keyboard.c      2012-04-20 21:26:18 +0000
+++ src/keyboard.c      2012-04-22 12:19:03 +0000
@@ -2984,7 +2984,10 @@
      own stuff with the echo area.  */
   if (!CONSP (c)
       || (!(EQ (Qhelp_echo, XCAR (c)))
-         && !(EQ (Qswitch_frame, XCAR (c)))))
+         && !(EQ (Qswitch_frame, XCAR (c)))
+         /* Don't wipe echo area for select window events: These might
+            get delayed via `mouse-autoselect-window' (Bug#11304).  */
+         && !(EQ (Qselect_window, XCAR (c)))))
       if (!NILP (echo_area_buffer[0]))
        safe_run_hooks (Qecho_area_clear_hook);

reply via email to

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