From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.bugs Subject: bug#2932: call-interactively wrongly calls mouse-leave-buffer-hook Date: Mon, 19 Jul 2021 16:42:10 +0200 Message-ID: <87k0lmnz5p.fsf@gnus.org> References: <20090408211553.GA2627@muc.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26891"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 2932@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jul 19 16:43:09 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5UU9-0006m3-35 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Jul 2021 16:43:09 +0200 Original-Received: from localhost ([::1]:51450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m5UU8-0003R7-4b for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Jul 2021 10:43:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35618) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m5UU2-0003QV-2y for bug-gnu-emacs@gnu.org; Mon, 19 Jul 2021 10:43:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48146) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m5UU1-00025l-Ou for bug-gnu-emacs@gnu.org; Mon, 19 Jul 2021 10:43:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m5UU1-0003TT-HO for bug-gnu-emacs@gnu.org; Mon, 19 Jul 2021 10:43:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Jul 2021 14:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 2932 X-GNU-PR-Package: emacs Original-Received: via spool by 2932-submit@debbugs.gnu.org id=B2932.162670574813300 (code B ref 2932); Mon, 19 Jul 2021 14:43:01 +0000 Original-Received: (at 2932) by debbugs.gnu.org; 19 Jul 2021 14:42:28 +0000 Original-Received: from localhost ([127.0.0.1]:59689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5UTU-0003SR-D0 for submit@debbugs.gnu.org; Mon, 19 Jul 2021 10:42:28 -0400 Original-Received: from quimby.gnus.org ([95.216.78.240]:45688) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m5UTS-0003SB-Dv for 2932@debbugs.gnu.org; Mon, 19 Jul 2021 10:42:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=j4D9ggVmFdfXphavwcJdfT2OK+OWHr9sfIu19788mhY=; b=NwwqAklnyoFEX32HFK3hlKI9FW 6FwQpMNMCnlJjD2pgIB5kJ9COSqNKiXGLCCDUf3Cf3o+GcUetrsR3BWyxYk5OcmFC84r2KsDqDQQi wtFJ7zV+UXj7KGCuH0wdWFIr/tAgzF8ssuoAdLYtcWJlQfWI848N4vi57uNwjICfsCY4=; Original-Received: from cm-84.212.220.105.getinternet.no ([84.212.220.105] helo=elva) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1m5UTG-0007oP-FX; Mon, 19 Jul 2021 16:42:19 +0200 X-Now-Playing: Colored Music's _Individual Beauty_: "De To Re Mi" In-Reply-To: <20090408211553.GA2627@muc.de> (Alan Mackenzie's message of "Wed, 8 Apr 2009 21:15:53 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:210248 Archived-At: Alan Mackenzie 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 # [3 times] Leaving # 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