GNU bug report logs -
#2932
call-interactively wrongly calls mouse-leave-buffer-hook
Previous Next
Reported by: Alan Mackenzie <acm <at> muc.de>
Date: Wed, 8 Apr 2009 21:25:05 UTC
Severity: normal
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
Hi, Emacs!
In call-interactively (callint.c L~449), whilst processing `@' ("switch
to the window the mouse was clicked in") in an interactive string, the
code runs the hook `mouse-leave-buffer-hook'.
The code HASN'T CHECKED that this new window is different from the
current window, and even if it is, whether the new window is displaying
a different buffer. Hence the hook is wrongly invoked when the mouse is
clicked in the current window.
Here is a fragment of the guilty code:
else if (*string == '@')
{
Lisp_Object event, tem;
event = (next_event < key_count
? AREF (keys, next_event)
: Qnil);
if (EVENT_HAS_PARAMETERS (event)
&& (tem = XCDR (event), CONSP (tem))
&& (tem = XCAR (tem), CONSP (tem))
&& (tem = XCAR (tem), WINDOWP (tem)))
{ /* <======================= Check for different window missing here. */
if (MINI_WINDOW_P (XWINDOW (tem))
&& ! (minibuf_level > 0 && EQ (tem, minibuf_window)))
error ("Attempt to select inactive minibuffer window");
/* If the current buffer wants to clean up, let it. */
if (!NILP (Vmouse_leave_buffer_hook))
call1 (Vrun_hooks, Qmouse_leave_buffer_hook); /* <============== Possibly spurious call */
Fselect_window (tem, Qnil);
}
string++;
}
######################################################
Similarly, DEFUN ("handle-switch-frame" (in frame.c L922) calls the same
hook without checking the new buffer is different. This is _probably_
also a bug (I haven't checked whether handle-switch-frame's callers
perform this check).
######################################################
Similarly, there are several runnings of this hook from Lisp code, that
don't check the new buffer is different from the old.
This probably isn't important enough to delay a release.
--
Alan Mackenzie (Nuremberg, Germany).
This bug report was last modified 3 years and 303 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.