aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1994-06-28 17:02:40 +0000
committerRichard M. Stallman1994-06-28 17:02:40 +0000
commita98ea3f945a231230ffd5fbaa8fff6ba4319de97 (patch)
tree5fdc854929e9a6c4146d557d59795835165526d9 /src
parent99b9e975034c4e75341188be392d4b3c91b626ef (diff)
downloademacs-a98ea3f945a231230ffd5fbaa8fff6ba4319de97.tar.gz
emacs-a98ea3f945a231230ffd5fbaa8fff6ba4319de97.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 246c79f59cc..100857f8e5a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -952,8 +952,10 @@ command_loop_1 ()
952 952
953 /* Make sure this hook runs after commands that get errors and 953 /* Make sure this hook runs after commands that get errors and
954 throw to top level. */ 954 throw to top level. */
955 if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks)) 955 /* Note that the value cell will never directly contain nil
956 safe_run_hooks (&Vpost_command_hook); 956 if the symbol is a local variable. */
957 if (!NILP (XSYMBOL (Qpost_command_hook)->value) && !NILP (Vrun_hooks))
958 safe_run_hooks (Qpost_command_hook);
957 959
958 /* Do this after running Vpost_command_hook, for consistency. */ 960 /* Do this after running Vpost_command_hook, for consistency. */
959 last_command = this_command; 961 last_command = this_command;
@@ -1074,8 +1076,10 @@ command_loop_1 ()
1074 /* Execute the command. */ 1076 /* Execute the command. */
1075 1077
1076 this_command = cmd; 1078 this_command = cmd;
1077 if (!NILP (Vpre_command_hook) && !NILP (Vrun_hooks)) 1079 /* Note that the value cell will never directly contain nil
1078 safe_run_hooks (&Vpre_command_hook); 1080 if the symbol is a local variable. */
1081 if (!NILP (XSYMBOL (Qpre_command_hook)->value) && !NILP (Vrun_hooks))
1082 safe_run_hooks (Qpre_command_hook);
1079 1083
1080 if (NILP (this_command)) 1084 if (NILP (this_command))
1081 { 1085 {
@@ -1211,8 +1215,10 @@ command_loop_1 ()
1211 } 1215 }
1212 directly_done: ; 1216 directly_done: ;
1213 1217
1214 if (!NILP (Vpost_command_hook) && !NILP (Vrun_hooks)) 1218 /* Note that the value cell will never directly contain nil
1215 safe_run_hooks (&Vpost_command_hook); 1219 if the symbol is a local variable. */
1220 if (!NILP (XSYMBOL (Qpost_command_hook)->value) && !NILP (Vrun_hooks))
1221 safe_run_hooks (Qpost_command_hook);
1216 1222
1217 /* If there is a prefix argument, 1223 /* If there is a prefix argument,
1218 1) We don't want last_command to be ``universal-argument'' 1224 1) We don't want last_command to be ``universal-argument''
@@ -1248,15 +1254,17 @@ command_loop_1 ()
1248 to mysteriously evaporate. */ 1254 to mysteriously evaporate. */
1249static void 1255static void
1250safe_run_hooks (hook) 1256safe_run_hooks (hook)
1251 Lisp_Object *hook; 1257 Lisp_Object hook;
1252{ 1258{
1253 int count = specpdl_ptr - specpdl; 1259 int count = specpdl_ptr - specpdl;
1254 specbind (Qinhibit_quit, Qt); 1260 specbind (Qinhibit_quit, Qt);
1255 1261
1256 Vcommand_hook_internal = *hook; 1262 /* We read and set the variable with functions,
1257 *hook = Qnil; 1263 in case it's buffer-local. */
1264 Vcommand_hook_internal = Fsymbol_value (hook);
1265 Fset (hook, Qnil);
1258 call1 (Vrun_hooks, Qcommand_hook_internal); 1266 call1 (Vrun_hooks, Qcommand_hook_internal);
1259 *hook = Vcommand_hook_internal; 1267 Fset (hook, Vcommand_hook_internal);
1260 1268
1261 unbind_to (count, Qnil); 1269 unbind_to (count, Qnil);
1262} 1270}
@@ -4406,7 +4414,7 @@ read_key_sequence (keybuf, bufsize, prompt)
4406 { 4414 {
4407 if (!NILP (prompt)) 4415 if (!NILP (prompt))
4408 echo_prompt (XSTRING (prompt)->data); 4416 echo_prompt (XSTRING (prompt)->data);
4409 else if (cursor_in_echo_area) 4417 else if (cursor_in_echo_area && echo_keystrokes)
4410 /* This doesn't put in a dash if the echo buffer is empty, so 4418 /* This doesn't put in a dash if the echo buffer is empty, so
4411 you don't always see a dash hanging out in the minibuffer. */ 4419 you don't always see a dash hanging out in the minibuffer. */
4412 echo_dash (); 4420 echo_dash ();
@@ -4551,7 +4559,8 @@ read_key_sequence (keybuf, bufsize, prompt)
4551 { 4559 {
4552 key = keybuf[t]; 4560 key = keybuf[t];
4553 add_command_key (key); 4561 add_command_key (key);
4554 echo_char (key); 4562 if (echo_keystrokes)
4563 echo_char (key);
4555 } 4564 }
4556 4565
4557 /* If not, we should actually read a character. */ 4566 /* If not, we should actually read a character. */
@@ -5087,7 +5096,8 @@ read_key_sequence (keybuf, bufsize, prompt)
5087 Better ideas? */ 5096 Better ideas? */
5088 for (; t < mock_input; t++) 5097 for (; t < mock_input; t++)
5089 { 5098 {
5090 echo_char (keybuf[t]); 5099 if (echo_keystrokes)
5100 echo_char (keybuf[t]);
5091 add_command_key (keybuf[t]); 5101 add_command_key (keybuf[t]);
5092 } 5102 }
5093 5103