GNU bug report logs - #30955
27.0.50; Mouse clicks on header-line in Info are broken

Previous Next

Package: emacs;

Reported by: Eli Zaretskii <eliz <at> gnu.org>

Date: Mon, 26 Mar 2018 14:55:01 UTC

Severity: normal

Found in version 27.0.50

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: m43cap <at> yandex.com, 30955 <at> debbugs.gnu.org
Subject: bug#30955: 27.0.50; Mouse clicks on header-line in Info are broken
Date: Thu, 29 Mar 2018 09:11:41 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
>> Cc: 30955 <at> debbugs.gnu.org, m43cap <at> yandex.com
>> Date: Thu, 29 Mar 2018 08:10:03 -0400
>> 
>> There's indeed a bug, here, which is that it says
>> 
>>     (translated from <mouse-2>)
>> 
>> instead of
>> 
>>     (translated from <mouse-1>)
>> 
>> I assume it's because the fix I installed modifies the event in-place,
>> so the recording of "untranslated events" gets changed by side-effect.
>
> I don't think so: I saw the mouse-2 part even before you fixed the
> problem.

Maybe you've seen it with yet-older code, such as the one in the
emacs-26 branch (in that code, the mouse-1 => mouse-2 remapping was done
elsewhere (i.e. as part of the processing of down-mouse-1) so
read_key_sequence never even saw the mouse-1 event to put it into the
raw_keybuf)?

> So I think it's something else at work.

Yet the second hunk below does fix this problem (the first hunk fixes
the same problem but for C-h l, and the third just removes code which
does something wrong, and I have no idea why the code was there in the
first place).


        Stefan


diff --git a/src/keyboard.c b/src/keyboard.c
index 044e3fac69..6380e8585f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3258,7 +3258,10 @@ record_char (Lisp_Object c)
       if (!recorded)
 	{
 	  total_keys += total_keys < NUM_RECENT_KEYS;
-	  ASET (recent_keys, recent_keys_index, c);
+	  ASET (recent_keys, recent_keys_index,
+                /* Copy the event, in case it gets modified by side-effect
+                   by some remapping function.  */
+                CONSP (c) ? Fcopy_sequence (c) : c);
 	  if (++recent_keys_index >= NUM_RECENT_KEYS)
 	    recent_keys_index = 0;
 	}
@@ -9296,7 +9299,10 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
 	    }
 
 	  GROW_RAW_KEYBUF;
-	  ASET (raw_keybuf, raw_keybuf_count, key);
+	  ASET (raw_keybuf, raw_keybuf_count,
+                /* Copy the event, in case it gets modified by side-effect
+                   by some remapping function.  */
+                CONSP (key) ? Fcopy_sequence (key) : key);
 	  raw_keybuf_count++;
 	}
 
@@ -9343,9 +9349,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
 		      && BUFFERP (XWINDOW (window)->contents)
 		      && XBUFFER (XWINDOW (window)->contents) != current_buffer)
 		    {
-		      GROW_RAW_KEYBUF;
-		      ASET (raw_keybuf, raw_keybuf_count, key);
-		      raw_keybuf_count++;
 		      keybuf[t] = key;
 		      mock_input = t + 1;
 




This bug report was last modified 7 years and 135 days ago.

Previous Next


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