On 19 Jan 2002, Jan Vroonhof yowled:
Nix <nix(a)esperi.demon.co.uk> writes:
Congratulations: You have reached the next stage of enlightenment, you
have rediscovered the disabled-command-hook-only-works-if-called-that
bug. Only few have gone before. [1]
:)
I spotted it about half a year ago and never bothered to follow it up.
Weird, is it? I had a go ad fixing it 2 years ago but failed then.
I will have another try.
No point, I've done it already :)
[1] Maybe somebody put it in as "so you think you are no
longer a novice?"-test?
I hope not, 'cos I've just blown the lid off their evil plans :)
It looks more like a straight typo to me.
Anyway, the bug is that, in command_execute(), the hook is run by
passing the *variable* to run_hook(), not the symbol pointing at the
variable.
So the symbol is evaluated, then *the name that's in a symbol with that
name* is run. If the function in `disabled-command-hook' has the same
name as the hook variable, this is invisible; it just goes round twice.
But if you change it it breaks.
Patch (against 21.4; applying to 21.5 would doubtless be easy but I
haven't produced the diff for that yet):
2002-01-18 Nix <nix(a)esperi.demon.co.uk>
* event-stream.c (Qdisabled_command_hook): New variable.
* cmdloop.c (syms_of_cmdloop): Initialize it.
* lisp.h (constant symbols): Prototype it.
* eval.c (command_execute): Call hook using it, not using
Vdisabled_command_hook.
diff -durN 21.4.6-orig/src/cmdloop.c 21.4.6/src/cmdloop.c
--- 21.4.6-orig/src/cmdloop.c Mon Jul 23 15:10:21 2001
+++ 21.4.6/src/cmdloop.c Thu Jan 17 14:19:18 2002
@@ -610,6 +610,7 @@
defsymbol (&Qreally_early_error_handler, "really-early-error-handler");
defsymbol (&Qtop_level, "top-level");
defsymbol (&Qerrors_deactivate_region, "errors-deactivate-region");
+ defsymbol (&Qdisabled_command_hook, "disabled-command-hook");
#ifndef LISP_COMMAND_LOOP
DEFSUBR (Frecursive_edit);
diff -durN 21.4.6-orig/src/eval.c 21.4.6/src/eval.c
--- 21.4.6-orig/src/eval.c Mon Aug 6 13:56:12 2001
+++ 21.4.6/src/eval.c Thu Jan 17 14:16:14 2002
@@ -2946,7 +2946,7 @@
debug_on_next_call = 0; /* #### from FSFmacs; correct? */
if (SYMBOLP (cmd) && !NILP (Fget (cmd, Qdisabled, Qnil)))
- return run_hook (Vdisabled_command_hook);
+ return run_hook (Qdisabled_command_hook);
for (;;)
{
diff -durN 21.4.6-orig/src/event-stream.c 21.4.6/src/event-stream.c
--- 21.4.6-orig/src/event-stream.c Tue Jan 15 11:22:10 2002
+++ 21.4.6/src/event-stream.c Thu Jan 17 14:29:56 2002
@@ -135,7 +135,7 @@
/* Non-nil disable property on a command means
do not execute it; call disabled-command-hook's value instead. */
-Lisp_Object Qdisabled, Vdisabled_command_hook;
+Lisp_Object Qdisabled, Qdisabled_command_hook, Vdisabled_command_hook;
EXFUN (Fnext_command_event, 2);
diff -durN 21.4.6-orig/src/lisp.h 21.4.6/src/lisp.h
--- 21.4.6-orig/src/lisp.h Mon Jan 7 14:17:41 2002
+++ 21.4.6/src/lisp.h Thu Jan 17 14:14:05 2002
@@ -3198,7 +3198,7 @@
extern Lisp_Object Qcrlf, Qcurrent_menubar, Qctext;
extern Lisp_Object Qcyclic_variable_indirection, Qdecode;
extern Lisp_Object Qdefun, Qdevice_live_p;
-extern Lisp_Object Qdim, Qdisabled, Qdisplay_table;
+extern Lisp_Object Qdim, Qdisabled, Qdisabled_command_hook, Qdisplay_table;
extern Lisp_Object Qdomain_error;
extern Lisp_Object Qediting_error;
extern Lisp_Object Qencode, Qend_of_buffer, Qend_of_file, Qend_open;
--
`I personally would not stand in a river waving a graphite rod above my
head during a thunderstorm.' --- Harry Jackson