GNU bug report logs - #33749
26.1; input-decode-map to empty vector should preserve echo area

Previous Next

Package: emacs;

Reported by: Yuri Khan <yurivkhan <at> gmail.com>

Date: Fri, 14 Dec 2018 22:26:02 UTC

Severity: normal

Found in version 26.1

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Yuri Khan <yurivkhan <at> gmail.com>
Cc: 33749 <at> debbugs.gnu.org
Subject: bug#33749: 26.1; input-decode-map to empty vector should preserve echo area
Date: Tue, 25 Dec 2018 14:35:13 -0500
> Also, I cannot easily add a new condition at this particular point.
> It happens when Emacs reads each character of the sequence that will
> eventually turn out to map to an empty one, but I do not know that
> will be the case until the end.

I think The Right Thing to do is likely to move this code to
read_key_sequence, more specifically, move it to the point where we
*know* we really do have an event.

IOW, I think the patch below might be a better option (where we test
`indec.start > 0` to make sure some *decoded* event was read).

>> >> Also, who/where do you intend to set input-decode-preserve-echo?
>> Ah, so you're planning to set it once and for all globally?
> Terminal-locally, if it’s any better.

Only marginally.


        Stefan


diff --git a/src/keyboard.c b/src/keyboard.c
index baf2f51440..92ef79b09f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2928,22 +2928,6 @@ read_char (int commandflag, Lisp_Object map,
       Vinput_method_previous_message = previous_echo_area_message;
     }
 
-  /* Now wipe the echo area, except for help events which do their
-     own stuff with the echo area.  */
-  if (!CONSP (c)
-      || (!(EQ (Qhelp_echo, XCAR (c)))
-	  && !(EQ (Qswitch_frame, XCAR (c)))
-	  /* Don't wipe echo area for select window events: These might
-	     get delayed via `mouse-autoselect-window' (Bug#11304).  */
-	  && !(EQ (Qselect_window, XCAR (c)))))
-    {
-      if (!NILP (echo_area_buffer[0]))
-	{
-	  safe_run_hooks (Qecho_area_clear_hook);
-	  clear_message (1, 0);
-	}
-    }
-
  reread_for_input_method:
  from_macro:
   /* Pass this to the input method, if appropriate.  */
@@ -9070,6 +9054,23 @@ read_key_sequence (Lisp_Object *keybuf, Lisp_Object prompt,
       /* If not, we should actually read a character.  */
       else
 	{
+          /* Now wipe the echo area, except for help events which do their
+             own stuff with the echo area.  */
+          /* FIXME: This used to happen at the end of read_char (i.e. after
+             we read the first event of a key sequence), but we now do it just
+             before reading the second event, and only when we know that the
+             first event is a "real" one, rather than some internal event that
+             might be dropped altogether (e.g. help-event, switch-frame, or
+             some key that we remap to the empty sequence (bug#33749)).
+             Maybe we should even make sure that `fkey.star > 0` or maybe
+             even `keytran.start > 0`!?  */
+          if (indec.start > 0
+              && !NILP (echo_area_buffer[0]))
+	    {
+	      safe_run_hooks (Qecho_area_clear_hook);
+	      clear_message (1, 0);
+	    }
+
 	  {
 	    KBOARD *interrupted_kboard = current_kboard;
 	    struct frame *interrupted_frame = SELECTED_FRAME ();




This bug report was last modified 6 years and 234 days ago.

Previous Next


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