From: Chong Yidong Date: Sat, 2 Jul 2011 23:40:04 +0000 (-0400) Subject: Fix corner case in prefix-arg handling for mouse events (Bug#1586). X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~227 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7a8e04f79efdefcb3eb7cb2cf5dbb454a78cf24e;p=emacs.git 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. --- diff --git a/src/ChangeLog b/src/ChangeLog index cb5d3bacba5..8b4029bd7b3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 diff --git a/src/keyboard.c b/src/keyboard.c index 3441f1dfd12..16300e6154c 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1539,7 +1539,18 @@ command_loop_1 (void) 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 {