From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#2932: call-interactively wrongly calls mouse-leave-buffer-hook Date: Wed, 8 Apr 2009 21:15:53 +0000 Message-ID: <20090408211553.GA2627@muc.de> Reply-To: Alan Mackenzie , 2932@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1239227059 23413 80.91.229.12 (8 Apr 2009 21:44:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 8 Apr 2009 21:44:19 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Apr 08 23:45:36 2009 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LrfaJ-0003KP-6q for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Apr 2009 23:45:28 +0200 Original-Received: from localhost ([127.0.0.1]:39875 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LrfYu-00036P-R0 for geb-bug-gnu-emacs@m.gmane.org; Wed, 08 Apr 2009 17:44:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LrfYq-00035k-KM for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2009 17:43:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LrfYm-000345-D6 for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2009 17:43:56 -0400 Original-Received: from [199.232.76.173] (port=55315 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LrfYm-00033q-3c for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2009 17:43:52 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:42115) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LrfYl-0003Mm-G4 for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2009 17:43:51 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n38Lhm4p022996; Wed, 8 Apr 2009 14:43:49 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id n38LP6YJ016635; Wed, 8 Apr 2009 14:25:06 -0700 X-Loop: owner@emacsbugs.donarmstrong.com Resent-From: Alan Mackenzie Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 08 Apr 2009 21:25:05 +0000 Resent-Message-ID: Resent-Sender: owner@emacsbugs.donarmstrong.com X-Emacs-PR-Message: report 2932 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.123922538714392 (code B ref -1); Wed, 08 Apr 2009 21:25:05 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 8 Apr 2009 21:16:27 +0000 X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available. hammytokens:Tokens not available. Original-Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id n38LGLQJ014382 for ; Wed, 8 Apr 2009 14:16:23 -0700 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lrf88-0001Qg-Tw for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2009 17:16:21 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lrf84-0001PQ-4D for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2009 17:16:20 -0400 Original-Received: from [199.232.76.173] (port=38093 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lrf84-0001PN-0H for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2009 17:16:16 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:3308 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lrf83-0000fx-7K for bug-gnu-emacs@gnu.org; Wed, 08 Apr 2009 17:16:15 -0400 Original-Received: (qmail 5210 invoked by uid 3782); 8 Apr 2009 21:16:12 -0000 Original-Received: from acm.muc.de (pD9E5114E.dip.t-dialin.net [217.229.17.78]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Wed, 08 Apr 2009 23:16:10 +0200 Original-Received: (qmail 2964 invoked by uid 1000); 8 Apr 2009 21:15:53 -0000 Content-Disposition: inline User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Wed, 08 Apr 2009 17:43:56 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:27013 Archived-At: 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).