emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: questions about blink-cursor-mode


From: Drew Adams
Subject: RE: questions about blink-cursor-mode
Date: Wed, 18 Nov 2009 15:39:41 -0800

> > 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?
> 
> 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.)

Thanks, Juanma. Now that I see that explanation, I recall that I knew this at
one time - but I guess I forgot it. Note that not only is it not declared (e.g.
defvar), it is also not bound, which is why `C-h v' doesn't recognize it.

I still have the other questions I posed. In sum, what's the right (or a good)
way to do what I need?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]