* bug#8416: easy-mmode.el -- enhance define-minor-mode to define turn-on-* and turn-off-* functions
@ 2011-04-03 13:42 Jari Aalto
2011-04-03 17:46 ` Glenn Morris
2011-04-04 14:32 ` Stefan Monnier
0 siblings, 2 replies; 3+ messages in thread
From: Jari Aalto @ 2011-04-03 13:42 UTC (permalink / raw
To: 8416
Package: emacs
Version: 23.2+1-7
Severity: wishlist
It would be nice if the define-minor-mode would also define functions:
turn-on-*
turn-off-*
An example:
;; lisp/hl-line.el
(define-minor-mode hl-line-mode ...)
That would make it possible to add to ~/.emacs:
(add-hook 'nroff-mode-hook 'turn-on-hl-line-mode)
;; Or later:
(remove-hook 'nroff-mode-hook 'turn-on-hl-line-mode)
This would be much more cleaner than what is needed now:
(add-hook 'nroff-mode-hook '(lambda () (turn-on-hl-line-mode 1)))
...
;; the hook removal command is as messy
-- System Information
Debian Release: wheezy/sid
APT Prefers testing
APT policy: (990, testing) (500, unstable) (1, experimental)
Architecture: amd64
Kernel: Linux picasso 2.6.32-5-amd64 #1 SMP Wed Jan 12 03:40:32 UTC 2011 x86_64 GNU/Linux
Locale: LANG=en_DK.UTF-8
-- Versions of packages `emacs depends on'.
Depends:
emacs23 23.2+1-7 GNU Emacs is the extensible self-documenting
emacs23-lucid 23.2+1-7 GNU Emacs is the extensible self-documenting
emacs23-nox 23.2+1-7 GNU Emacs is the extensible self-documenting
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#8416: easy-mmode.el -- enhance define-minor-mode to define turn-on-* and turn-off-* functions
2011-04-03 13:42 bug#8416: easy-mmode.el -- enhance define-minor-mode to define turn-on-* and turn-off-* functions Jari Aalto
@ 2011-04-03 17:46 ` Glenn Morris
2011-04-04 14:32 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Glenn Morris @ 2011-04-03 17:46 UTC (permalink / raw
To: Jari Aalto; +Cc: 8416
Jari Aalto wrote:
> It would be nice if the define-minor-mode would also define functions:
>
> turn-on-*
> turn-off-*
You've proposed this kind of thing before, and it has been rejected.
http://debbugs.gnu.org/cgi/bugreport.cgi?msg=9;bug=4288
"...I don't like the turn-on-* and turn-off-* functions: we have
already the *-mode functions which should be plenty."
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7709#8
"There is no need for it (and neither is there a need for
turn-on-eldoc-mode). There is M-x eldoc-mode."
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#8416: easy-mmode.el -- enhance define-minor-mode to define turn-on-* and turn-off-* functions
2011-04-03 13:42 bug#8416: easy-mmode.el -- enhance define-minor-mode to define turn-on-* and turn-off-* functions Jari Aalto
2011-04-03 17:46 ` Glenn Morris
@ 2011-04-04 14:32 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2011-04-04 14:32 UTC (permalink / raw
To: Jari Aalto; +Cc: 8416-done
> It would be nice if the define-minor-mode would also define functions:
> turn-on-*
> turn-off-*
In Emacs-24, the `foo-mode' function of a minor mode *is* the
turn-on-foo-mode function (at least when called non-interactively
without an argument, e.g. on a normal hook).
> This would be much more cleaner than what is needed now:
> (add-hook 'nroff-mode-hook '(lambda () (turn-on-hl-line-mode 1)))
As mentioned, the above is not needed any more:
(add-hook 'nroff-mode-hook 'hl-line-mode)
will work just fine.
The turn-off-foo is rarely needed in my experience.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-04 14:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-03 13:42 bug#8416: easy-mmode.el -- enhance define-minor-mode to define turn-on-* and turn-off-* functions Jari Aalto
2011-04-03 17:46 ` Glenn Morris
2011-04-04 14:32 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.