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 #14 received at 2932 <at> debbugs.gnu.org (full text, mbox):
Alan Mackenzie <acm <at> muc.de> writes:
> 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.
Test code:
(setq mouse-leave-buffer-hook '((lambda ()
(message "Leaving %s" (current-buffer)))))
And then mouse-click. And, indeed, it's run even when not changing a
window.
... Uhm, OK, that was a slightly different thing. Try this:
(setq mouse-leave-buffer-hook '((lambda ()
(message "Leaving %s" (selected-window)))))
The hook is run three times in the selected window, and then it's run
once in the new buffer:
Leaving #<window 110 on sel.el> [3 times]
Leaving #<window 114 on *Messages*>
So the problem isn't just in call-interactively -- the hook is called a
lot -- on any mouse click, and whether we switch windows or not, and
both before and after the switch.
I'm guessing we can't change this at this point, so I'll just adjust the
doc string to reflect the current state of affairs instead.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
This bug report was last modified 3 years and 304 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.