GNU bug report logs - #2932
call-interactively wrongly calls mouse-leave-buffer-hook

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Alan Mackenzie <acm@HIDDEN>; dated Wed, 8 Apr 2009 21:25:05 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 2932 <at> debbugs.gnu.org:


Received: (at 2932) by debbugs.gnu.org; 18 Sep 2011 08:49:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 18 04:49:01 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1R5D3b-0003Tk-R6
	for submit <at> debbugs.gnu.org; Sun, 18 Sep 2011 04:49:00 -0400
Received: from hermes.netfonds.no ([80.91.224.195])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <larsi@HIDDEN>) id 1R5D3W-0003TI-8A
	for 2932 <at> debbugs.gnu.org; Sun, 18 Sep 2011 04:48:55 -0400
Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58]
	helo=stories.gnus.org)
	by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16)
	(Exim 4.72) (envelope-from <larsi@HIDDEN>)
	id 1R5Cyf-000619-9Y; Sun, 18 Sep 2011 10:43:53 +0200
From: Lars Magne Ingebrigtsen <larsi@HIDDEN>
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#2932: call-interactively wrongly calls mouse-leave-buffer-hook
In-Reply-To: <CAAeL0STAe16NXdFttUBJ236EjvyaifGuA6nKZSTWywzY7Us_Sg@HIDDEN>
	(Juanma Barranquero's message of "Sun, 10 Jul 2011 02:00:41 +0200")
Date: Sun, 18 Sep 2011 10:17:18 +0200
Message-ID: <m3d3eyz2lt.fsf@HIDDEN>
References: <20090408211553.GA2627@HIDDEN>
	<CAAeL0STAe16NXdFttUBJ236EjvyaifGuA6nKZSTWywzY7Us_Sg@HIDDEN>
User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)
X-Now-Playing: Eurythmics's _Touch_: "Right By Your Side"
MIME-Version: 1.0
Content-Type: text/plain
X-MailScanner-ID: 1R5Cyf-000619-9Y
X-Netfonds-MailScanner: Found to be clean
X-Netfonds-MailScanner-From: larsi@HIDDEN
MailScanner-NULL-Check: 1316940233.3604@W7oJRl6VClUd6oqqe4zHkg
X-Spam-Status: No
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 2932
Cc: Alan Mackenzie <acm@HIDDEN>, 2932 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

Juanma Barranquero <lekktu@HIDDEN> writes:

> The trunk still behaves as you describe.
>
> As a first pass, we should fix the docstring of
> `mouse-leave-buffer-hook'. It seems wrong for the docstring of a hook
> with "leave-buffer" in its name to talk about windows and not say a
> word about buffers...

Yes, that's a somewhat confusing doc string.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#2932; Package emacs. Full text available.

Message received at 2932 <at> debbugs.gnu.org:


Received: (at 2932) by debbugs.gnu.org; 10 Jul 2011 00:01:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 09 20:01:29 2011
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1QfhSj-0005gI-MC
	for submit <at> debbugs.gnu.org; Sat, 09 Jul 2011 20:01:29 -0400
Received: from mail-pz0-f44.google.com ([209.85.210.44])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1QfhSh-0005g5-51
	for 2932 <at> debbugs.gnu.org; Sat, 09 Jul 2011 20:01:27 -0400
Received: by pzk5 with SMTP id 5so2345914pzk.3
	for <2932 <at> debbugs.gnu.org>; Sat, 09 Jul 2011 17:01:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=ySNRkRPyHJ1+UImTGKldyAOsAzKsykNEH0SgsulMVw4=;
	b=OFpx5KeInRZwsWBZKkq1aA2CrGqc1OnuzMil7/RnbVpekeCmwaRlyeW74VHRQNO9G5
	3xkrYarH8t7NLl3QuprXpBx4QtOC94xHJtJWnBNfqCmY8SEcPJpjZpOhiryLDX3nsL6b
	zkgLvgyBBWksbA4wkBgMG4Rh80M3TMYLFohmU=
Received: by 10.143.91.16 with SMTP id t16mr1109211wfl.366.1310256081166; Sat,
	09 Jul 2011 17:01:21 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.142.144.4 with HTTP; Sat, 9 Jul 2011 17:00:41 -0700 (PDT)
In-Reply-To: <20090408211553.GA2627@HIDDEN>
References: <20090408211553.GA2627@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Sun, 10 Jul 2011 02:00:41 +0200
Message-ID: <CAAeL0STAe16NXdFttUBJ236EjvyaifGuA6nKZSTWywzY7Us_Sg@HIDDEN>
Subject: Re: bug#2932: call-interactively wrongly calls mouse-leave-buffer-hook
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -3.3 (---)
X-Debbugs-Envelope-To: 2932
Cc: 2932 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -3.3 (---)

On Wed, Apr 8, 2009 at 23:15, Alan Mackenzie <acm@HIDDEN> wrote:

> 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. =C2=A0Hence the hook is wrongly invoked when the mous=
e is
> clicked in the current window.

The trunk still behaves as you describe.

As a first pass, we should fix the docstring of
`mouse-leave-buffer-hook'. It seems wrong for the docstring of a hook
with "leave-buffer" in its name to talk about windows and not say a
word about buffers...

=C2=A0 =C2=A0 Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#2932; Package emacs. Full text available.

Message received at submit@HIDDEN:


Received: (at submit) by emacsbugs.donarmstrong.com; 8 Apr 2009 21:16:27 +0000
From acm@HIDDEN Wed Apr  8 14:16:26 2009
X-Spam-Checker-Version: SpamAssassin 3.2.5-bugs.debian.org_2005_01_02
	(2008-06-10) on rzlab.ucr.edu
X-Spam-Level: 
X-Spam-Bayes: score:0.5 Bayes not run. spammytokens:Tokens not available.
	hammytokens:Tokens not available.
X-Spam-Status: No, score=0.1 required=4.0 tests=FOURLA autolearn=no
	version=3.2.5-bugs.debian.org_2005_01_02
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 <submit@HIDDEN>; Wed, 8 Apr 2009 14:16:23 -0700
Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43)
	id 1Lrf88-0001Qg-Tw
	for bug-gnu-emacs@HIDDEN; Wed, 08 Apr 2009 17:16:21 -0400
Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43)
	id 1Lrf84-0001PQ-4D
	for bug-gnu-emacs@HIDDEN; Wed, 08 Apr 2009 17:16:20 -0400
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@HIDDEN; Wed, 08 Apr 2009 17:16:16 -0400
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 <acm@HIDDEN>)
	id 1Lrf83-0000fx-7K
	for bug-gnu-emacs@HIDDEN; Wed, 08 Apr 2009 17:16:15 -0400
Received: (qmail 5210 invoked by uid 3782); 8 Apr 2009 21:16:12 -0000
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
Received: (qmail 2964 invoked by uid 1000); 8 Apr 2009 21:15:53 -0000
Date: Wed, 8 Apr 2009 21:15:53 +0000
To: bug-gnu-emacs@HIDDEN
Subject: call-interactively wrongly calls mouse-leave-buffer-hook
Message-ID: <20090408211553.GA2627@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.9i
X-Delivery-Agent: TMDA/1.1.5 (Fettercairn)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9

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).





Acknowledgement sent to Alan Mackenzie <acm@HIDDEN>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs@HIDDEN>. Full text available.
Report forwarded to bug-submit-list@HIDDEN, Emacs Bugs <bug-gnu-emacs@HIDDEN>:
bug#2932; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.