* follow-mode's use of hooks
@ 2007-10-08 16:30 Juanma Barranquero
2007-10-09 1:14 ` Richard Stallman
0 siblings, 1 reply; 4+ messages in thread
From: Juanma Barranquero @ 2007-10-08 16:30 UTC (permalink / raw)
To: Emacs development discussions
I've just fixed follow-mode because it was running hooks twice, which
is a bug (at least, I hope there's no code out there depending on it.)
(add-hook 'follow-mode-hook
(lambda () (message "> follow-mode-hook")))
(add-hook 'follow-mode-off-hook
(lambda () (message "> follow-mode-off-hook")))
M-x follow-mode [RET]
=>
> follow-mode-hook [2 times]
Follow mode enabled
M-x follow-mode [RET]
=>
> follow-mode-off-hook
> follow-mode-hook
> follow-mode-off-hook
Follow mode disabled
However, the docstrings for `follow-mode' and `follow-mode-hook' are
still wrong, because they refer to `follow-mode-hook' as if only run
when entering follow-mode (sort of like the non-documented
`follow-mode-on-hook').
I'd be inclined to just apply the following patch, if nobody objects.
Juanma
Index: lisp/follow.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/follow.el,v
retrieving revision 1.37
diff -u -r1.37 follow.el
--- lisp/follow.el 8 Oct 2007 16:06:15 -0000 1.37
+++ lisp/follow.el 8 Oct 2007 16:24:05 -0000
@@ -278,7 +278,7 @@
:group 'convenience)
(defcustom follow-mode-hook nil
- "Hooks to run when Follow mode is turned on."
+ "Normal hook run by Follow mode."
:type 'hook
:group 'follow)
@@ -286,6 +286,7 @@
"Hooks to run when Follow mode is turned off."
:type 'hook
:group 'follow)
+(make-obsolete-variable 'follow-mode-off-hook 'follow-mode-hook "22.2")
;;{{{ Keymap/Menu
@@ -517,8 +518,7 @@
will listen to the output of processes and redisplay accordingly.
\(This is the default.)
-When Follow mode is switched on, the hook `follow-mode-hook'
-is called. When turned off, `follow-mode-off-hook' is called.
+This command runs the normal hook `follow-mode-hook'.
Keys specific to Follow mode:
\\{follow-mode-map}"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: follow-mode's use of hooks
2007-10-08 16:30 follow-mode's use of hooks Juanma Barranquero
@ 2007-10-09 1:14 ` Richard Stallman
2007-10-09 8:53 ` Juanma Barranquero
0 siblings, 1 reply; 4+ messages in thread
From: Richard Stallman @ 2007-10-09 1:14 UTC (permalink / raw)
To: Juanma Barranquero; +Cc: emacs-devel
However, the docstrings for `follow-mode' and `follow-mode-hook' are
still wrong, because they refer to `follow-mode-hook' as if only run
when entering follow-mode
Indeed, that should be fixed.
(defcustom follow-mode-hook nil
- "Hooks to run when Follow mode is turned on."
+ "Normal hook run by Follow mode."
"Run by Follow mode" is not correct either, because that
implies that the _mode itself_ runs the hook.
In fact, it is the function to enable or disable the mode
that runs the hook. That function is not Follow mode.
That function is `follow-mode'.
Do you see the right way to fix it, now?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-10 13:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-08 16:30 follow-mode's use of hooks Juanma Barranquero
2007-10-09 1:14 ` Richard Stallman
2007-10-09 8:53 ` Juanma Barranquero
2007-10-10 13:01 ` Richard Stallman
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.