Subject: bug#23933: 25.1.50; Run a buffer-local hook with mapc

From: Stefan Monnier <[email-masked]>
Date: Sun, 10 Jul 2016 13:02:42 -0400

>> A hook is a symbol whose symbol-value slot holds a list of functions;
>> this happens to match a dynamically-bound variable, but not
>> a lexically-bound variable.
> Maybe I misunderstand this, but are you saying a hook (and run-hooks)
> cannot be used in a file that uses lexical-binding?  If so, we had
> better documented that.

No, the issue is simply that `run-hooks' takes a symbol as argument.
You can do (run-hooks '<mydynvar>) because (symbol-value '<mydynvar>)
works, but you can't do (run-hooks '<mylexvar>) because (symbol-value
'<mylexvar>) won't work.

Using `run-hooks' on a let-bound variable is just a bad idea (just like
mixing let-binding and buffer-local binding on the same variable is
asking for trouble).

        Stefan