From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: follow-mode's use of hooks Date: Mon, 8 Oct 2007 18:30:21 +0200 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1191861057 4896 80.91.229.12 (8 Oct 2007 16:30:57 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 8 Oct 2007 16:30:57 +0000 (UTC) To: "Emacs development discussions" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 08 18:30:54 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IevV5-0004tr-PT for ged-emacs-devel@m.gmane.org; Mon, 08 Oct 2007 18:30:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IevV0-0007iR-56 for ged-emacs-devel@m.gmane.org; Mon, 08 Oct 2007 12:30:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IevUw-0007g2-CK for emacs-devel@gnu.org; Mon, 08 Oct 2007 12:30:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IevUs-0007cw-NK for emacs-devel@gnu.org; Mon, 08 Oct 2007 12:30:26 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IevUs-0007cd-IK for emacs-devel@gnu.org; Mon, 08 Oct 2007 12:30:22 -0400 Original-Received: from hs-out-0708.google.com ([64.233.178.248] helo=hs-out-2021.google.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IevUs-0006p7-70 for emacs-devel@gnu.org; Mon, 08 Oct 2007 12:30:22 -0400 Original-Received: by hs-out-2021.google.com with SMTP id 55so127475hsc for ; Mon, 08 Oct 2007 09:30:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; bh=Sx/lAXCW9G/juOx1j7S9wNzbPEMbM02PAOX2KTOjHWQ=; b=XMPwovGVJwBQsW/ZGTufCGNn43DykAmQudo6V1wLr7xQyF5iNgHip6UhvfKCSpZURpGOybcabjp2qb5qNGE53K8QGthGV/xPv6Oqg5NBQ11fVC3dxlMXza4LMmaCktcULTNhomzmzvgCe105gd4UG3J8cVswIstW2HfnzFbV/qU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=iG8TFKZXGkALHeRGjD7Qr8n3mrMV19Bd02Do3bc1u5jT9Rk+GPUllVbcC6YKK+40z8h6qzqV8GkxIXOlSpJ5EopXl/0lYIhRY//xHahLyKo7MjR+QuWD7+b1MNlt2kzTodXjLP0XNRgf8maGqsQARoFoars+6Dx1wy/qE8kw9Jo= Original-Received: by 10.90.89.5 with SMTP id m5mr307215agb.1191861021474; Mon, 08 Oct 2007 09:30:21 -0700 (PDT) Original-Received: by 10.90.103.8 with HTTP; Mon, 8 Oct 2007 09:30:21 -0700 (PDT) Content-Disposition: inline X-Detected-Kernel: Linux 2.4-2.6 (Google crawlbot) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:80410 Archived-At: 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}"