emacs-devel
[Top][All Lists]
Advanced

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

follow-mode's use of hooks


From: Juanma Barranquero
Subject: follow-mode's use of hooks
Date: Mon, 8 Oct 2007 18:30:21 +0200

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}"




reply via email to

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