From: Alan Mackenzie <acm@muc.de>
To: bug-gnu-emacs@gnu.org
Subject: bug#2932: call-interactively wrongly calls mouse-leave-buffer-hook
Date: Wed, 8 Apr 2009 21:15:53 +0000 [thread overview]
Message-ID: <20090408211553.GA2627@muc.de> (raw)
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).
next reply other threads:[~2009-04-08 21:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-08 21:15 Alan Mackenzie [this message]
2011-07-10 0:00 ` bug#2932: call-interactively wrongly calls mouse-leave-buffer-hook Juanma Barranquero
2011-09-18 8:17 ` Lars Magne Ingebrigtsen
2021-07-19 14:42 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090408211553.GA2627@muc.de \
--to=acm@muc.de \
--cc=2932@emacsbugs.donarmstrong.com \
--cc=bug-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.