diff src/keyboard.c @ 8076:3a35434b19d2

(safe_run_hooks): Take symbol as arg. Use Fsymbol_value and Fset. (command_loop_1): Pass symbol to safe_run_hooks. Look in the value cell to check for trivial case (no hooks). (read_key_sequence): Don't echo if echo_keystrokes is 0.
author Richard M. Stallman <rms@gnu.org>
date Tue, 28 Jun 1994 17:02:40 +0000
parents 1aaf0461446d
children df2986993482
line wrap: on
line diff
--- a/src/keyboard.c	Tue Jun 28 09:27:39 1994 +0000
+++ b/src/keyboard.c	Tue Jun 28 17:02:40 1994 +0000
@@ -952,8 +952,10 @@
 
   /* Make sure this hook runs after commands that get errors and
      throw to top level.  */
-  if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks))
-    safe_run_hooks (&Vpost_command_hook);
+  /* Note that the value cell will never directly contain nil
+     if the symbol is a local variable.  */
+  if (!NILP (XSYMBOL (Qpost_command_hook)->value) && !NILP (Vrun_hooks))
+    safe_run_hooks (Qpost_command_hook);
 
   /* Do this after running Vpost_command_hook, for consistency.  */
   last_command = this_command;
@@ -1074,8 +1076,10 @@
       /* Execute the command.  */
 
       this_command = cmd;
-      if (!NILP (Vpre_command_hook) && !NILP (Vrun_hooks))
-	safe_run_hooks (&Vpre_command_hook);
+      /* Note that the value cell will never directly contain nil
+	 if the symbol is a local variable.  */
+      if (!NILP (XSYMBOL (Qpre_command_hook)->value) && !NILP (Vrun_hooks))
+	safe_run_hooks (Qpre_command_hook);
 
       if (NILP (this_command))
 	{
@@ -1211,8 +1215,10 @@
 	}
     directly_done: ;
 
-      if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks))
-	safe_run_hooks (&Vpost_command_hook);
+      /* Note that the value cell will never directly contain nil
+	 if the symbol is a local variable.  */
+      if (!NILP (XSYMBOL (Qpost_command_hook)->value) && !NILP (Vrun_hooks))
+	safe_run_hooks (Qpost_command_hook);
 
       /* If there is a prefix argument,
 	 1) We don't want last_command to be ``universal-argument''
@@ -1248,15 +1254,17 @@
    to mysteriously evaporate.  */
 static void
 safe_run_hooks (hook)
-     Lisp_Object *hook;
+     Lisp_Object hook;
 {
   int count = specpdl_ptr - specpdl;
   specbind (Qinhibit_quit, Qt);
 
-  Vcommand_hook_internal = *hook;
-  *hook = Qnil;
+  /* We read and set the variable with functions,
+     in case it's buffer-local.  */
+  Vcommand_hook_internal = Fsymbol_value (hook);
+  Fset (hook, Qnil);
   call1 (Vrun_hooks, Qcommand_hook_internal);
-  *hook = Vcommand_hook_internal;
+  Fset (hook, Vcommand_hook_internal);
 
   unbind_to (count, Qnil);
 }
@@ -4406,7 +4414,7 @@
     {
       if (!NILP (prompt))
 	echo_prompt (XSTRING (prompt)->data);
-      else if (cursor_in_echo_area)
+      else if (cursor_in_echo_area && echo_keystrokes)
 	/* This doesn't put in a dash if the echo buffer is empty, so
 	   you don't always see a dash hanging out in the minibuffer.  */
 	echo_dash ();
@@ -4551,7 +4559,8 @@
 	{
 	  key = keybuf[t];
 	  add_command_key (key);
-	  echo_char (key);
+	  if (echo_keystrokes)
+	    echo_char (key);
 	}
 
       /* If not, we should actually read a character.  */
@@ -5087,7 +5096,8 @@
      Better ideas?  */
   for (; t < mock_input; t++)
     {
-      echo_char (keybuf[t]);
+      if (echo_keystrokes)
+	echo_char (keybuf[t]);
       add_command_key (keybuf[t]);
     }