From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Richard Sharman Newsgroups: gmane.emacs.devel Subject: Re: patch to hilight-chg not in emacs 22.1 Date: Thu, 1 May 2008 23:21:58 -0400 Message-ID: <4546978A-1618-4698-B2CA-0C0F3E12C5CF@pobox.com> References: <7C11E945-3ED3-45A0-A3D2-1F700D12BC9B@pobox.com> <8CB2E924-9CF1-4312-911C-1DA4783D19FD@pobox.com> <1DEEFF6E-3F47-47FE-82AC-AFFA68D3F7FF@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v753) Content-Type: multipart/mixed; boundary=Apple-Mail-3--536914914 X-Trace: ger.gmane.org 1209698690 16596 80.91.229.12 (2 May 2008 03:24:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 2 May 2008 03:24:50 +0000 (UTC) Cc: martin rudalics , Stefan Monnier , Richard Stallman , Emacs Devel To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri May 02 05:25:23 2008 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 1Jrlti-0002Kw-Gc for ged-emacs-devel@m.gmane.org; Fri, 02 May 2008 05:25:22 +0200 Original-Received: from localhost ([127.0.0.1]:38370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jrlt1-0002Xn-8X for ged-emacs-devel@m.gmane.org; Thu, 01 May 2008 23:24:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JrlrG-0001rN-Gk for emacs-devel@gnu.org; Thu, 01 May 2008 23:22:50 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JrlrF-0001r7-3I for emacs-devel@gnu.org; Thu, 01 May 2008 23:22:50 -0400 Original-Received: from [199.232.76.173] (port=54360 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JrlrE-0001r2-Pn for emacs-devel@gnu.org; Thu, 01 May 2008 23:22:48 -0400 Original-Received: from a-sasl-fastnet.sasl.smtp.pobox.com ([207.106.133.19] helo=sasl.smtp.pobox.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jrlr6-0008WP-DY; Thu, 01 May 2008 23:22:40 -0400 Original-Received: from localhost.localdomain (localhost [127.0.0.1]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id 096965CCB; Thu, 1 May 2008 23:22:14 -0400 (EDT) Original-Received: from [192.168.1.3] (206-248-165-151.dsl.teksavvy.com [206.248.165.151]) by a-sasl-fastnet.sasl.smtp.pobox.com (Postfix) with ESMTP id E23A95CC7; Thu, 1 May 2008 23:22:05 -0400 (EDT) In-Reply-To: X-Mailer: Apple Mail (2.753) X-Pobox-Relay-ID: F590812E-17F6-11DD-9BBA-80001473D85F-93789671!a-sasl-fastnet.pobox.com X-detected-kernel: by monty-python.gnu.org: Solaris 10 (beta) 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:96311 Archived-At: --Apple-Mail-3--536914914 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed On 25-Apr-08, at 10:27 AM, Juanma Barranquero wrote: > After this change: > > 2008-04-03 Richard Sharman > ... > the file comments and the docstring of `highlight-changes-mode' still > reference `highlight-changes-disable-hook', which seem not to exist > anymore. I suppose that's an oversight and it should be obsoleted? > (And also `highlight-changes-enable-hook', which weirdly enough still > exists.) You're right; thanks. Because define-minor-mode is used there is already a hook called highlight-changes-mode-hook that can be used to do both of the above functions. I changed the documentation at the top of the file to use this hook. I see there are also two other hooks generated: highlight-changes- mode-on-hook and highlight-changes-mode-off-hook, but since the comment says "The on/off hooks are here for backward compatibility only." I thought it better not to document the fact that these are available. Here is a patch against 1.52 and a Changelog file. --Apple-Mail-3--536914914 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name=hilit-chg.el.cdif Content-Disposition: attachment; filename=hilit-chg.el.cdif *** hilit-chg.el.1.52 Thu May 1 22:59:49 2008 --- hilit-chg.el Thu May 1 23:04:27 2008 *************** *** 62,85 **** ;; You can automatically rotate faces when the buffer is saved; ;; see function `highlight-changes-rotate-faces' for how to do this. ! ;; There are two hooks used by `highlight-changes-mode': ! ;; `highlight-changes-enable-hook' - is run when Highlight Changes mode ! ;; is enabled for a buffer. ! ;; `highlight-changes-disable-hook' - is run when Highlight Changes mode ! ;; is disabled for a buffer. ! ! ;; Example usage: ! ;; (defun my-highlight-changes-enable-hook () ! ;; (add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t) ! ;; ) ! ;; ! ;; (defun my-highlight-changes-disable-hook () ! ;; (remove-hook 'write-file-functions 'highlight-changes-rotate-faces t) ! ;; ) ;; ! ;; (add-hook 'highlight-changes-enable-hook 'my-highlight-changes-enable-hook) ! ;; (add-hook 'highlight-changes-disable-hook ! ;; 'my-highlight-changes-disable-hook) ;; Automatically enabling Highlight Changes mode --- 62,78 ---- ;; You can automatically rotate faces when the buffer is saved; ;; see function `highlight-changes-rotate-faces' for how to do this. ! ;; The hook `highlight-changes-mode-hook' is called when ! ;; Highlight Changes mode is turned on or off. ! ;; When it called, variable `highlight-changes-mode' has been updated ! ;; to the new value. ;; ! ;; Example usage: ! ;; (defun my-highlight-changes-mode-hook () ! ;; (if highlight-changes-mode ! ;; (add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t) ! ;; (remove-hook 'write-file-functions 'highlight-changes-rotate-faces t) ! ;; )) ;; Automatically enabling Highlight Changes mode *************** *** 175,181 **** ;; previous active/passive aspect of highlight-changes-mode. ;; - Removed highlight-changes-toggle-hook ;; - Put back eval-and-compile inadvertently dropped ! ;;; Code: --- 168,176 ---- ;; previous active/passive aspect of highlight-changes-mode. ;; - Removed highlight-changes-toggle-hook ;; - Put back eval-and-compile inadvertently dropped ! ;; May 2008 ! ;; - Removed highlight-changes-disable-hook and highlight-changes-enable-hook ! ;; because highlight-changes-mode-hook can do both. ;;; Code: *************** *** 353,363 **** through various faces. \\[highlight-compare-with-file] - mark text as changed by comparing this buffer with the contents of a file ! \\[highlight-compare-buffers] highlights differences between two buffers. ! ! Hook variables: ! `highlight-changes-enable-hook': called when enabling Highlight Changes mode. ! `highlight-changes-disable-hook': called when disabling Highlight Changes mode." nil ;; init-value hilit-chg-string ;; lighter nil ;; keymap --- 348,354 ---- through various faces. \\[highlight-compare-with-file] - mark text as changed by comparing this buffer with the contents of a file ! \\[highlight-compare-buffers] highlights differences between two buffers." nil ;; init-value hilit-chg-string ;; lighter nil ;; keymap *************** *** 372,379 **** (setq highlight-changes-mode (not highlight-changes-mode))) (if highlight-changes-mode ;; it is being turned on - ;; the hook has been moved into hilit-chg-set - ;; (run-hooks 'highlight-changes-enable-hook)) (hilit-chg-set) ;; mode is turned off (hilit-chg-clear))) --- 363,368 ---- *************** *** 634,641 **** (setq highlight-changes-visible-mode highlight-changes-visibility-initial-state) (hilit-chg-update) (force-mode-line-update) ! (add-hook 'after-change-functions 'hilit-chg-set-face-on-change nil t) ! (run-hooks 'highlight-changes-enable-hook)) (defun hilit-chg-clear () "Remove Highlight Changes mode for this buffer. --- 623,629 ---- (setq highlight-changes-visible-mode highlight-changes-visibility-initial-state) (hilit-chg-update) (force-mode-line-update) ! (add-hook 'after-change-functions 'hilit-chg-set-face-on-change nil t)) (defun hilit-chg-clear () "Remove Highlight Changes mode for this buffer. --Apple-Mail-3--536914914 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed --Apple-Mail-3--536914914 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name=ChangeLog Content-Disposition: attachment; filename=ChangeLog 2008-05-01 Richard Sharman * hilit-chg.el (highlight-changes-mode): Removed references to hooks that no longer exist. Because define-minor-mode is used the hook highlight-changes-mode-hook exists and can do what both the old hooks used to to. The documentation at the top of the file was updated to demonstrate this. (highlight-changes-mode): Remove commented out call to a hook function that is no longer there. (hilit-chg-set): Remove running of highlight-changes-enable-hook. --Apple-Mail-3--536914914--