all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Juanma Barranquero" <lekktu@gmail.com>
To: "Emacs development discussions" <emacs-devel@gnu.org>
Subject: follow-mode's use of hooks
Date: Mon, 8 Oct 2007 18:30:21 +0200	[thread overview]
Message-ID: <f7ccd24b0710080930m65081f68jb7b3f29138a2cc89@mail.gmail.com> (raw)

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	other threads:[~2007-10-08 16:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-08 16:30 Juanma Barranquero [this message]
2007-10-09  1:14 ` follow-mode's use of hooks Richard Stallman
2007-10-09  8:53   ` Juanma Barranquero
2007-10-10 13:01     ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7ccd24b0710080930m65081f68jb7b3f29138a2cc89@mail.gmail.com \
    --to=lekktu@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.