[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: questions about blink-cursor-mode
From: |
Juanma Barranquero |
Subject: |
Re: questions about blink-cursor-mode |
Date: |
Thu, 19 Nov 2009 00:31:42 +0100 |
On Wed, Nov 18, 2009 at 19:59, Drew Adams <address@hidden> wrote:
> blink-cursor-mode is defined using `define-minor-mode', and the doc for that
> says that "It finishes by running the mode hook variable `MODE-hook'." But
> there
> doesn't seem to be any variable `blink-cursor-mode-hook'. How can that be? Why
> is that? If there were such a hook, I could presumably use it to update my
> variable that reflects the user's preference.
The code for `define-minor-mode' does this:
(let* (...
(hook (intern (concat mode-name "-hook")))
(hook-on (intern (concat mode-name "-on-hook")))
(hook-off (intern (concat mode-name "-off-hook")))
...)
...
,@body
;; The on/off hooks are here for backward compatibility only.
(run-hooks ',hook (if ,mode ',hook-on ',hook-off))
...
so the hook is run even if the symbol is not defvared. Some packages
declare the hook variable, some don't. (Yes, I agree it would be
better to always declare them, if only to add the standard "This is a
normal hook blah blah" docstring.)
Juanma