Reiner Steib writes:
On Wed, Nov 26 2008, Stephen J. Turnbull wrote:
> I would prefer to implement turn-on/turn-off file pseudo-variables
> (like 'mode' and 'eval').
The justification for turn-on-... (and turn-off-...) is/was that is
simplifies adding it to a hook:
(add-hook 'text-mode-hook 'turn-on-auto-fill)
Of course; this use is isomorphic to the one in file variables, which
is just a form of local hook, after all.
So with a galaxy of minor modes we add `turn-on-foo' and even more
rarely `turn-off-foo' commands only when users complain about a
particular one, is that it? This is an ugly hack. I can think of
many generic ways to deal with it. For example, add-hook (or
run-hooks!) could do
(when (and (symbolp function)
(not (functionp function)))
(cond ((string-match "^turn-on-" (symbol-name function))
(setq function `(lambda (bool) (,function 1))))
((string-match "^turn-off-" (symbol-name function))
(setq function `(lambda (bool) (,function 0))))))
before mutating (or running) the hook. Note that if you're dealing
with an existing `turn-on-foo' this will DTRT.
If that's too much magic for one's taste, then we could update
define-minor-mode to always generate the "turn-on/off-" forms.
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta