From: Richard Sharman <rsharman@pobox.com>
To: Juanma Barranquero <lekktu@gmail.com>
Cc: martin rudalics <rudalics@gmx.at>,
Stefan Monnier <monnier@iro.umontreal.ca>,
Richard Stallman <rms@gnu.org>, Emacs Devel <emacs-devel@gnu.org>
Subject: Re: patch to hilight-chg not in emacs 22.1
Date: Thu, 1 May 2008 23:21:58 -0400 [thread overview]
Message-ID: <4546978A-1618-4698-B2CA-0C0F3E12C5CF@pobox.com> (raw)
In-Reply-To: <f7ccd24b0804250727i14ece469y2879226f47142429@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1012 bytes --]
On 25-Apr-08, at 10:27 AM, Juanma Barranquero wrote:
> After this change:
>
> 2008-04-03 Richard Sharman <rsharman@pobox.com>
> ...
> 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.
[-- Attachment #2: hilit-chg.el.cdif --]
[-- Type: application/octet-stream, Size: 4216 bytes --]
*** 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.
[-- Attachment #3: Type: text/plain, Size: 1 bytes --]
[-- Attachment #4: ChangeLog --]
[-- Type: application/octet-stream, Size: 516 bytes --]
2008-05-01 Richard Sharman <rsharman@pobox.com>
* 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.
next prev parent reply other threads:[~2008-05-02 3:21 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-16 17:52 patch to hilight-chg not in emacs 22.1 Richard Sharman
2008-03-17 14:11 ` Stefan Monnier
2008-03-18 3:11 ` Richard Sharman
2008-03-18 16:51 ` Stefan Monnier
2008-03-19 2:43 ` Richard Sharman
2008-03-19 16:20 ` Stefan Monnier
2008-04-25 14:27 ` Juanma Barranquero
2008-05-02 3:21 ` Richard Sharman [this message]
2008-05-02 8:53 ` Juanma Barranquero
2008-03-18 9:55 ` martin rudalics
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=4546978A-1618-4698-B2CA-0C0F3E12C5CF@pobox.com \
--to=rsharman@pobox.com \
--cc=emacs-devel@gnu.org \
--cc=lekktu@gmail.com \
--cc=monnier@iro.umontreal.ca \
--cc=rms@gnu.org \
--cc=rudalics@gmx.at \
/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.