all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Eli Zaretskii <eliz@gnu.org>
Cc: m43cap@yandex.com, 30955@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	[thread overview]
Message-ID: <jwvlgeb83pb.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <83y3ibcbms.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 29 Mar 2018 15:24:59 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Stefan Monnier <monnier@IRO.UMontreal.CA>
>> Cc: 30955@debbugs.gnu.org, m43cap@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;
 





  reply	other threads:[~2018-03-29 13:11 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26 14:54 bug#30955: 27.0.50; Mouse clicks on header-line in Info are broken Eli Zaretskii
2018-03-27 18:46 ` Stefan Monnier
2018-03-27 19:27   ` Stefan Monnier
2018-03-28  6:07     ` Colin Baxter
2018-03-29 11:00     ` Eli Zaretskii
2018-03-29 12:10       ` Stefan Monnier
2018-03-29 12:24         ` Eli Zaretskii
2018-03-29 13:11           ` Stefan Monnier [this message]
2018-03-29 13:30             ` Colin Baxter
2018-03-31 17:18             ` Eli Zaretskii
2018-03-31 18:56               ` Colin Baxter
2018-03-31 19:03                 ` Eli Zaretskii
2018-03-31 19:16                   ` Eli Zaretskii
2018-03-31 20:59                     ` Colin Baxter
2018-03-31 20:55                   ` Colin Baxter
2018-03-31 23:40               ` Stefan Monnier
2018-04-01  6:50                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvlgeb83pb.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=30955@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=m43cap@yandex.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.