Subject: Re: bug#19875: 25.0.50; Setting an input-method-function breaks prefix show on the echo area

From: [email-masked] (Óscar Fuentes)
Date: Sun, 15 Feb 2015 19:03:56 +0100

Eli Zaretskii <[email-masked]> writes:

> This happens on the release branch, and in Emacs 24.4 as well.

The relevant area of code in keyboard.c is very old. The bug probably
has more than 15 years.

Semi-blind fix attempt:

diff --git a/src/keyboard.c b/src/keyboard.c
index bcb51cf..8b65f0e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3095,7 +3095,15 @@ read_char (int commandflag, Lisp_Object map,
 
       cancel_echoing ();
       ok_to_echo_at_next_pause = saved_ok_to_echo;
-      kset_echo_string (current_kboard, saved_echo_string);
+      /* Do not restore the echo area string if the user is
+         introducing a prefix argument. Otherwise we end with
+         repetitions of the partially introduced prefix
+         argument. (bug#19875) */
+      Lisp_Object pa = intern ("prefix-arg");
+      if (NILP(pa))
+        {
+          kset_echo_string (current_kboard, saved_echo_string);
+        }
       current_kboard->echo_after_prompt = saved_echo_after_prompt;
       if (saved_immediate_echo)
 	echo_now ();