|
From: | Stefan Monnier |
Subject: | Re: turn-on/off-*MODE* |
Date: | Wed, 26 Sep 2012 17:47:25 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux) |
> Is there a general guideline for when to add or not add these? Yes: never add them. > + ;;;###autoload > + (defun turn-on-hl-line () > + "Unconditionally turn on highlight-line mode." > + (hl-line-mode 1)) (hl-line-mode) is the same as (hl-line-mode 1), so you can rewrite is as: ;;;###autoload (defun turn-on-hl-line () "Unconditionally turn on highlight-line mode." (hl-line-mode)) => ;;;###autoload (defalias 'turn-on-hl-line #'hl-line-mode "Unconditionally turn on highlight-line mode.") at which point you can decide it's not worth the trouble. > + ;;;###autoload > + (defun turn-off-hl-line () > + "Unconditionally turn off highlight-line mode." > + (hl-line-mode -1)) I've virtually never seen it used. So for the very rare cases (lambda () (foo-mode -1)) works just as well and isn't that much longer #'turn-off-foo-mode. Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |