changeset 30051:70d9d51a864c

(show_help_echo): New function, extracted from read_char. Feval its `msg' argument if it's a cons cell. (read_char): Use it. (follow_key): Pass `autoload' to get_keyelt.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 05 Jul 2000 14:01:15 +0000
parents ed1979c6dfb9
children 324e0b1b2ac1
files src/keyboard.c
diffstat 1 files changed, 32 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Wed Jul 05 13:41:00 2000 +0000
+++ b/src/keyboard.c	Wed Jul 05 14:01:15 2000 +0000
@@ -1895,6 +1895,35 @@
   return c;
 }
 
+/* Display a help message in the echo area.  */
+void
+show_help_echo (msg)
+     Lisp_Object msg;
+{
+  int count = specpdl_ptr - specpdl;
+
+  specbind (Qmessage_truncate_lines, Qt);
+  if (CONSP (msg))
+    msg = Feval (msg);
+
+  if (!NILP (Vshow_help_function))
+    call1 (Vshow_help_function, msg);
+  else if (/* Don't overwrite minibuffer contents.  */
+	   !MINI_WINDOW_P (XWINDOW (selected_window))
+	   /* Don't overwrite a keystroke echo.  */
+	   && NILP (echo_message_buffer)
+	   /* Don't overwrite a prompt.  */
+	   && !cursor_in_echo_area)
+    {
+      if (STRINGP (msg))
+	message3_nolog (msg, XSTRING (msg)->size, STRING_MULTIBYTE (msg));
+      else
+	message (0);
+    }
+
+  unbind_to (count, Qnil);
+}
+
 
 
 /* Input of single characters from keyboard */
@@ -2639,28 +2668,7 @@
   /* Display help if not echoing.  */
   if (CONSP (c) && EQ (XCAR (c), Qhelp_echo))
     {
-      Lisp_Object msg;
-      int count = specpdl_ptr - specpdl;
-
-      specbind (Qmessage_truncate_lines, Qt);
-      msg = XCDR (XCDR (c));
-
-      if (!NILP (Vshow_help_function))
-	call1 (Vshow_help_function, msg);
-      else if (/* Don't overwrite minibuffer contents.  */
-	       !MINI_WINDOW_P (XWINDOW (selected_window))
-	       /* Don't overwrite a keystroke echo.  */
-	       && NILP (echo_message_buffer)
-	       /* Don't overwrite a prompt.  */
-	       && !cursor_in_echo_area)
-	{
-	  if (STRINGP (msg))
-	    message3_nolog (msg, XSTRING (msg)->size, STRING_MULTIBYTE (msg));
-	  else
-	    message (0);
-	}
-
-      unbind_to (count, Qnil);
+      show_help_echo (XCDR (XCDR (c)));
       goto retry;
     }
   
@@ -6266,7 +6274,7 @@
 	  item = XCDR (item);
 	}
 	  
-      /* Maybee key binding cache.  */
+      /* Maybe key binding cache.  */
       if (CONSP (item) && CONSP (XCAR (item))
 	  && (NILP (XCAR (XCAR (item)))
 	      || VECTORP (XCAR (XCAR (item)))))
@@ -7370,7 +7378,7 @@
 	  else
 	    map = current[i];
 
-	  defs[i] = get_keyelt (access_keymap (map, key, 1, 0), 0);
+	  defs[i] = get_keyelt (access_keymap (map, key, 1, 0), 1);
 	  if (! NILP (defs[i]))
 	    first_binding = i;
 	}