From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#1586: prefix arg when mouse clicking on header line Date: Mon, 04 Jul 2011 15:05:44 -0400 Message-ID: References: <87boxcl08i.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1309806727 16700 80.91.229.12 (4 Jul 2011 19:12:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 4 Jul 2011 19:12:07 +0000 (UTC) Cc: 1586@debbugs.gnu.org, Roland Winkler To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 04 21:12:01 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QdoYq-00058e-Af for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Jul 2011 21:12:00 +0200 Original-Received: from localhost ([::1]:42866 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdoYo-0006nh-VP for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Jul 2011 15:11:58 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:37716) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdoT9-0005Pc-TP for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2011 15:06:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QdoT5-0002em-9J for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2011 15:06:07 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49525) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QdoT5-0002ef-26 for bug-gnu-emacs@gnu.org; Mon, 04 Jul 2011 15:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QdoT4-0004B9-3a; Mon, 04 Jul 2011 15:06:02 -0400 X-Loop: help-debbugs@gnu.org 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: Original-Received: via spool by 1586-submit@debbugs.gnu.org id=B1586.130980635316048 (code B ref 1586); Mon, 04 Jul 2011 19:06:02 +0000 Original-Received: (at 1586) by debbugs.gnu.org; 4 Jul 2011 19:05:53 +0000 Original-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 Original-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" Original-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 Original-Received: by pastel.home (Postfix, from userid 20848) id 9EFC058DBA; Mon, 4 Jul 2011 15:05:44 -0400 (EDT) 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) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 04 Jul 2011 15:06:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:47980 Archived-At: >> 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