From unknown Sat Jun 21 03:26:43 2025 X-Loop: don@donarmstrong.com Subject: bug#1586: prefix arg when mouse clicking on header line Reply-To: "Roland Winkler" , 1586@debbugs.gnu.org Resent-From: "Roland Winkler" Resent-To: bug-submit-list@lists.donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Wed, 17 Dec 2008 06:48:45 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1586 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Received: via spool by submit@emacsbugs.donarmstrong.com id=B.122937470317815 (code B ref -1); Wed, 17 Dec 2008 06:48:45 +0000 Received: (at submit) by emacsbugs.donarmstrong.com; 15 Dec 2008 20:58:23 +0000 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) 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.0 required=4.0 tests=none autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mBFKwGoW017795 for ; Mon, 15 Dec 2008 12:58:18 -0800 Received: from mx10.gnu.org ([199.232.76.166]:48243) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1LCKVR-0008DT-De for emacs-pretest-bug@gnu.org; Mon, 15 Dec 2008 15:57:33 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1LCKW6-0005ll-IM for emacs-pretest-bug@gnu.org; Mon, 15 Dec 2008 15:58:15 -0500 Received: from tfkpsv.physik.uni-erlangen.de ([131.188.164.197]:3568) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LCKW6-0005lS-4c for emacs-pretest-bug@gnu.org; Mon, 15 Dec 2008 15:58:14 -0500 Received: from tfkp04.physik.uni-erlangen.de (tfkp04.physik.uni-erlangen.de [131.188.164.204]) by tfkpsv.physik.uni-erlangen.de (Postfix) with ESMTP id 8A9F421486 for ; Mon, 15 Dec 2008 21:58:08 +0100 (CET) Date: Mon, 15 Dec 2008 21:58:06 +0100 Message-Id: From: "Roland Winkler" To: emacs-pretest-bug@gnu.org X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.4-2.6 If a command takes a mouse event and an (optional) prefix arg as its arguments, the interactive specifications are (interactive "e\nP") or (interactive (list last-input-event current-prefix-arg)) This works fine inside the main part of a window. For a command that does the same thing in the header line, these interactive specifications do not work. Instead one needs, e..g, (interactive (list last-input-event last-prefix-arg)) i.e., current-prefix-arg needs to be replaced by last-prefix-arg. This problem occured in the context of the command proced-sort-header in proced.el, which provides a complete test example. See also http://lists.gnu.org/archive/html/emacs-devel/2008-12/msg00559.html In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.14.4) of 2008-12-05 on regnitz Windowing system distributor `The X.Org Foundation', version 11.0.10502000 From unknown Sat Jun 21 03:26:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#1586: prefix arg when mouse clicking on header line References: In-Reply-To: Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 02 Jul 2011 23:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 1586 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: "Roland Winkler" Cc: 1586@debbugs.gnu.org Received: via spool by 1586-submit@debbugs.gnu.org id=B1586.13096500712592 (code B ref 1586); Sat, 02 Jul 2011 23:42:02 +0000 Received: (at 1586) by debbugs.gnu.org; 2 Jul 2011 23:41:11 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qd9oE-0000fl-Nn for submit@debbugs.gnu.org; Sat, 02 Jul 2011 19:41:10 -0400 Received: from vm-emlprdomr-02.its.yale.edu ([130.132.50.143]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qd9oC-0000fY-5k for 1586@debbugs.gnu.org; Sat, 02 Jul 2011 19:41:09 -0400 Received: from furball (dhcp128036226015.central.yale.edu [128.36.226.15]) (authenticated bits=0) by vm-emlprdomr-02.its.yale.edu (8.14.4/8.14.4) with ESMTP id p62Nf1Ju003211 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Sat, 2 Jul 2011 19:41:02 -0400 From: Chong Yidong Date: Sat, 02 Jul 2011 19:41:01 -0400 Message-ID: <87boxcl08i.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.143 X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) > If a command takes a mouse event and an (optional) prefix arg as its > arguments, the interactive specifications are > > (interactive "e\nP") > > or > > (interactive (list last-input-event current-prefix-arg)) > > This works fine inside the main part of a window. For a command > that does the same thing in the header line, these interactive > specifications do not work. Thanks for the bug report. I've committed a fix. From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 02 19:41:21 2011 Received: (at control) by debbugs.gnu.org; 2 Jul 2011 23:41:22 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qd9oO-0000g9-UR for submit@debbugs.gnu.org; Sat, 02 Jul 2011 19:41:21 -0400 Received: from vm-emlprdomr-03.its.yale.edu ([130.132.50.144]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qd9oN-0000fv-Ui for control@debbugs.gnu.org; Sat, 02 Jul 2011 19:41:20 -0400 Received: from furball (dhcp128036226015.central.yale.edu [128.36.226.15]) (authenticated bits=0) by vm-emlprdomr-03.its.yale.edu (8.14.4/8.14.4) with ESMTP id p62NfENe023510 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Sat, 2 Jul 2011 19:41:14 -0400 From: Chong Yidong To: control@debbugs.gnu.org Subject: close 1586 Date: Sat, 02 Jul 2011 19:41:13 -0400 Message-ID: <87zkkwi73a.fsf@stupidchicken.com> MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.144 X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) close 1586 thanks From unknown Sat Jun 21 03:26:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#1586: prefix arg when mouse clicking on header line Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Jul 2011 19:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 1586 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Chong Yidong Cc: 1586@debbugs.gnu.org, Roland Winkler Received: via spool by 1586-submit@debbugs.gnu.org id=B1586.130980635316048 (code B ref 1586); Mon, 04 Jul 2011 19:06:02 +0000 Received: (at 1586) by debbugs.gnu.org; 4 Jul 2011 19:05:53 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdoSv-0004Am-50 for submit@debbugs.gnu.org; Mon, 04 Jul 2011 15:05:53 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QdoSt-0004AW-0s for 1586@debbugs.gnu.org; Mon, 04 Jul 2011 15:05:51 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EACcOEk5FxIxr/2dsb2JhbABTp3t4iHrBKoY2BJAvji2ELA X-IronPort-AV: E=Sophos;i="4.65,474,1304308800"; d="scan'208";a="120407857" Received: from 69-196-140-107.dsl.teksavvy.com (HELO pastel.home) ([69.196.140.107]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 04 Jul 2011 15:05:44 -0400 Received: by pastel.home (Postfix, from userid 20848) id 9EFC058DBA; Mon, 4 Jul 2011 15:05:44 -0400 (EDT) From: Stefan Monnier Message-ID: References: <87boxcl08i.fsf@stupidchicken.com> Date: Mon, 04 Jul 2011 15:05:44 -0400 In-Reply-To: <87boxcl08i.fsf@stupidchicken.com> (Chong Yidong's message of "Sat, 02 Jul 2011 19:41:01 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.1 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.1 (--) >> If a command takes a mouse event and an (optional) prefix arg as its >> arguments, the interactive specifications are >> (interactive "e\nP") >> or >> (interactive (list last-input-event current-prefix-arg)) >> >> This works fine inside the main part of a window. For a command >> that does the same thing in the header line, these interactive >> specifications do not work. > Thanks for the bug report. I've committed a fix. Does this actually fix the problem? If so, I don't understand why: a down event that's not bound to anything should be dropped entirely by read-key-sequence. So my guess at the problem is that [header-line down-mouse-1] is not left unbound but instead is bound to something (e.g. `mouse-drag-header-line' or `ignore'), so your code won't be executed at all in that case. Now, I'm not sure if we should preserve the prefix arg even if the down event is bound, or rather just change `mouse-drag-header-line' and/or `ignore' to propagate the current-prefix-arg to the next event; but unless I'm missing something your fix should have no effect. Stefan >>>>> "Chong" == Chong Yidong writes: > ------------------------------------------------------------ > revno: 104891 > committer: Chong Yidong > branch nick: trunk > timestamp: Sat 2011-07-02 19:40:04 -0400 > message: > Fix corner case in prefix-arg handling for mouse events (Bug#1586). > * src/keyboard.c (command_loop_1): If a down-mouse event is unbound, > leave any prefix arg for the up event. > modified: > src/ChangeLog > src/keyboard.c > === modified file 'src/ChangeLog' > --- a/src/ChangeLog 2011-07-02 16:18:24 +0000 > +++ b/src/ChangeLog 2011-07-02 23:40:04 +0000 > @@ -1,3 +1,8 @@ > +2011-07-02 Chong Yidong > + > + * keyboard.c (command_loop_1): If a down-mouse event is unbound, > + leave any prefix arg for the up event (Bug#1586). > + > 2011-07-02 Lars Magne Ingebrigtsen > * lread.c (syms_of_lread): Mention single symbols defined by > === modified file 'src/keyboard.c' > --- a/src/keyboard.c 2011-07-02 04:27:41 +0000 > +++ b/src/keyboard.c 2011-07-02 23:40:04 +0000 > @@ -1539,7 +1539,18 @@ > message_with_string ("%s is undefined", keys, 0); > KVAR (current_kboard, defining_kbd_macro) = Qnil; > update_mode_lines = 1; > - KVAR (current_kboard, Vprefix_arg) = Qnil; > + /* If this is a down-mouse event, don't reset prefix-arg; > + pass it to the command run by the up event. */ > + if (EVENT_HAS_PARAMETERS (last_command_event)) > + { > + Lisp_Object breakdown > + = parse_modifiers (EVENT_HEAD (last_command_event)); > + int modifiers = XINT (XCAR (XCDR (breakdown))); > + if (!(modifiers & down_modifier)) > + KVAR (current_kboard, Vprefix_arg) = Qnil; > + } > + else > + KVAR (current_kboard, Vprefix_arg) = Qnil; > } > else > { > _______________________________________________ > Emacs-diffs mailing list > Emacs-diffs@gnu.org > https://lists.gnu.org/mailman/listinfo/emacs-diffs From unknown Sat Jun 21 03:26:43 2025 X-Loop: help-debbugs@gnu.org Subject: bug#1586: prefix arg when mouse clicking on header line Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Jul 2011 20:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 1586 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Stefan Monnier Cc: 1586@debbugs.gnu.org, Roland Winkler Received: via spool by 1586-submit@debbugs.gnu.org id=B1586.130981264931780 (code B ref 1586); Mon, 04 Jul 2011 20:51:01 +0000 Received: (at 1586) by debbugs.gnu.org; 4 Jul 2011 20:50:49 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qdq6T-0008GX-If for submit@debbugs.gnu.org; Mon, 04 Jul 2011 16:50:49 -0400 Received: from vm-emlprdomr-03.its.yale.edu ([130.132.50.144]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qdq6S-0008GL-A2 for 1586@debbugs.gnu.org; Mon, 04 Jul 2011 16:50:48 -0400 Received: from furball (dhcp128036226224.central.yale.edu [128.36.226.224]) (authenticated bits=0) by vm-emlprdomr-03.its.yale.edu (8.14.4/8.14.4) with ESMTP id p64Kog1S002572 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Mon, 4 Jul 2011 16:50:42 -0400 From: Chong Yidong References: <87boxcl08i.fsf@stupidchicken.com> Date: Mon, 04 Jul 2011 16:50:42 -0400 In-Reply-To: (Stefan Monnier's message of "Mon, 04 Jul 2011 15:05:44 -0400") Message-ID: <87y60dkbx9.fsf@stupidchicken.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.71 on 130.132.50.144 X-Spam-Score: -2.7 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Stefan Monnier writes: > Does this actually fix the problem? If so, I don't understand why: > a down event that's not bound to anything should be dropped entirely by > read-key-sequence. > > So my guess at the problem is that [header-line down-mouse-1] is not > left unbound but instead is bound to something > (e.g. `mouse-drag-header-line' or `ignore'), so your code won't be > executed at all in that case. > > Now, I'm not sure if we should preserve the prefix arg even if the down > event is bound, or rather just change `mouse-drag-header-line' and/or > `ignore' to propagate the current-prefix-arg to the next event; but > unless I'm missing something your fix should have no effect. The patch does fix the test case: (defun test-bug () (interactive) (global-set-key [header-line mouse-1] 'foo) (setq header-line-format "a")) (defun foo (event &optional arg) (interactive "e\nP") (setq foo (cons arg event)) (message "%s" foo)) C-u mouse-1 on the header line with and without the patch, and you'll see the prefix arg being passed through, and being dropped.