emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: which-key (was: Adding a "quick-help" menu)


From: Gregory Heytings
Subject: Re: which-key (was: Adding a "quick-help" menu)
Date: Sun, 18 Sep 2022 08:58:09 +0000



I guess we should simply change the "echo keystrokes" functionality so instead of just displaying "C-x-" it could display something like "C-x- [Hit C-h for help]".


Like this?

diff --git a/src/keyboard.c b/src/keyboard.c
index ca51c80da0..a9eb840c76 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -500,7 +500,8 @@ echo_add_key (Lisp_Object c)
     }

   if ((NILP (echo_string) || SCHARS (echo_string) == 0)
-      && help_char_p (c))
+      && help_char_p (c)
+      && NILP (Vecho_keystrokes_mention_help))
     {
       static const char text[] = " (Type ? for further options)";
       int len = sizeof text - 1;
@@ -559,11 +560,20 @@ echo_dash (void)
        return;
     }

-  /* Put a dash at the end of the buffer temporarily,
+  /* Put a dash, and maybe the help key, at the end of the buffer temporarily,
      but make it go away when the next character is added.  */
-  AUTO_STRING (dash, "-");
-  kset_echo_string (current_kboard,
-                   concat2 (KVAR (current_kboard, echo_string), dash));
+  if (NILP (Vecho_keystrokes_mention_help))
+    {
+      AUTO_STRING (dash, "- ");
+      kset_echo_string (current_kboard,
+                       concat2 (KVAR (current_kboard, echo_string), dash));
+    }
+  else
+    {
+      AUTO_STRING (dash, "- [Type C-h for help]");
+      kset_echo_string (current_kboard,
+                       concat2 (KVAR (current_kboard, echo_string), dash));
+    }
   echo_now ();
 }

@@ -13107,6 +13117,10 @@ syms_of_keyboard (void)
 is called with one argument, the string that was selected.  */);;
   Vpost_select_region_hook = Qnil;

+  DEFVAR_LISP ("echo-keystrokes-mention-help", Vecho_keystrokes_mention_help,
+              doc: /* Non-nil means display help key after echoing keystrokes. 
*/);
+  Vecho_keystrokes_mention_help = Qt;
+
   pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]