diff options
| -rw-r--r-- | lisp/hilit-chg.el | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el index 59468147cb7..df95766641b 100644 --- a/lisp/hilit-chg.el +++ b/lisp/hilit-chg.el | |||
| @@ -81,11 +81,11 @@ | |||
| 81 | ;; | 81 | ;; |
| 82 | ;; Example usage: | 82 | ;; Example usage: |
| 83 | ;; (defun my-highlight-changes-enable-hook () | 83 | ;; (defun my-highlight-changes-enable-hook () |
| 84 | ;; (add-hook 'local-write-file-hooks 'highlight-changes-rotate-faces) | 84 | ;; (add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t) |
| 85 | ;; ) | 85 | ;; ) |
| 86 | ;; | 86 | ;; |
| 87 | ;; (defun my-highlight-changes-disable-hook () | 87 | ;; (defun my-highlight-changes-disable-hook () |
| 88 | ;; (remove-hook 'local-write-file-hooks 'highlight-changes-rotate-faces) | 88 | ;; (remove-hook 'write-file-functions 'highlight-changes-rotate-faces t) |
| 89 | ;; ) | 89 | ;; ) |
| 90 | ;; | 90 | ;; |
| 91 | ;; (add-hook 'highlight-changes-enable-hook 'my-highlight-changes-enable-hook) | 91 | ;; (add-hook 'highlight-changes-enable-hook 'my-highlight-changes-enable-hook) |
| @@ -213,7 +213,7 @@ | |||
| 213 | ;; indentation on inserts gets underlined (which can look pretty ugly!). | 213 | ;; indentation on inserts gets underlined (which can look pretty ugly!). |
| 214 | 214 | ||
| 215 | (defface highlight-changes | 215 | (defface highlight-changes |
| 216 | '((((min-colors 88) (class color)) (:foreground "red1" )) | 216 | '((((min-colors 88) (class color)) (:foreground "red1")) |
| 217 | (((class color)) (:foreground "red" )) | 217 | (((class color)) (:foreground "red" )) |
| 218 | (t (:inverse-video t))) | 218 | (t (:inverse-video t))) |
| 219 | "Face used for highlighting changes." | 219 | "Face used for highlighting changes." |
| @@ -270,7 +270,7 @@ This variable must be set to one of the symbols `active' or `passive'." | |||
| 270 | (defcustom highlight-changes-global-initial-state 'passive | 270 | (defcustom highlight-changes-global-initial-state 'passive |
| 271 | "*What state `global-highlight-changes' should start in. | 271 | "*What state `global-highlight-changes' should start in. |
| 272 | This is used if `global-highlight-changes' is called with no argument. | 272 | This is used if `global-highlight-changes' is called with no argument. |
| 273 | This variable must be set to either `active' or `passive'" | 273 | This variable must be set to either `active' or `passive'." |
| 274 | :type '(choice (const :tag "Active" active) | 274 | :type '(choice (const :tag "Active" active) |
| 275 | (const :tag "Passive" passive)) | 275 | (const :tag "Passive" passive)) |
| 276 | :group 'highlight-changes) | 276 | :group 'highlight-changes) |
| @@ -302,8 +302,8 @@ A list means the elements are major modes suitable for Highlight | |||
| 302 | Changes mode, or a list whose first element is `not' followed by major | 302 | Changes mode, or a list whose first element is `not' followed by major |
| 303 | modes which are not suitable. | 303 | modes which are not suitable. |
| 304 | 304 | ||
| 305 | t means the buffer is suitable if it is visiting a file and its name | 305 | A value of t means the buffer is suitable if it is visiting a file and |
| 306 | does not begin with ` ' or `*'. | 306 | its name does not begin with ` ' or `*'. |
| 307 | 307 | ||
| 308 | A value of nil means no buffers are suitable for `global-highlight-changes' | 308 | A value of nil means no buffers are suitable for `global-highlight-changes' |
| 309 | \(effectively disabling the mode). | 309 | \(effectively disabling the mode). |
| @@ -488,7 +488,7 @@ This is the opposite of `hilit-chg-display-changes'." | |||
| 488 | "Fix change overlays in region between BEG and END. | 488 | "Fix change overlays in region between BEG and END. |
| 489 | 489 | ||
| 490 | Ensure the overlays agree with the changes as determined from | 490 | Ensure the overlays agree with the changes as determined from |
| 491 | the text properties of type `hilit-chg' ." | 491 | the text properties of type `hilit-chg'." |
| 492 | ;; Remove or alter overlays in region beg..end | 492 | ;; Remove or alter overlays in region beg..end |
| 493 | (let (ov-start ov-end props q) | 493 | (let (ov-start ov-end props q) |
| 494 | ;; temp for debugging: | 494 | ;; temp for debugging: |
| @@ -641,12 +641,12 @@ Functions: | |||
| 641 | \\[highlight-changes-remove-highlight] - remove the change face from the region | 641 | \\[highlight-changes-remove-highlight] - remove the change face from the region |
| 642 | \\[highlight-changes-rotate-faces] - rotate different \"ages\" of changes \ | 642 | \\[highlight-changes-rotate-faces] - rotate different \"ages\" of changes \ |
| 643 | through | 643 | through |
| 644 | various faces. | 644 | various faces |
| 645 | 645 | ||
| 646 | Hook variables: | 646 | Hook variables: |
| 647 | `highlight-changes-enable-hook' - when enabling Highlight Changes mode. | 647 | `highlight-changes-enable-hook' - when enabling Highlight Changes mode |
| 648 | `highlight-changes-toggle-hook' - when entering active or passive state | 648 | `highlight-changes-toggle-hook' - when entering active or passive state |
| 649 | `highlight-changes-disable-hook' - when turning off Highlight Changes mode." | 649 | `highlight-changes-disable-hook' - when turning off Highlight Changes mode" |
| 650 | (interactive "P") | 650 | (interactive "P") |
| 651 | (if (or (display-color-p) | 651 | (if (or (display-color-p) |
| 652 | (and (fboundp 'x-display-grayscale-p) (x-display-grayscale-p))) | 652 | (and (fboundp 'x-display-grayscale-p) (x-display-grayscale-p))) |
| @@ -781,11 +781,11 @@ of `highlight-changes-face-list', one level older changes are shown in | |||
| 781 | face described by the second element, and so on. Very old changes remain | 781 | face described by the second element, and so on. Very old changes remain |
| 782 | shown in the last face in the list. | 782 | shown in the last face in the list. |
| 783 | 783 | ||
| 784 | You can automatically rotate colors when the buffer is saved | 784 | You can automatically rotate colors when the buffer is saved by adding |
| 785 | by adding the following to `local-write-file-hooks', by evaling it in the | 785 | this function to `write-file-functions' as a buffer-local value. To do |
| 786 | buffer to be saved): | 786 | this, eval the following in the buffer to be saved: |
| 787 | 787 | ||
| 788 | \(add-hook 'local-write-file-hooks 'highlight-changes-rotate-faces)" | 788 | \(add-hook 'write-file-functions 'highlight-changes-rotate-faces nil t)" |
| 789 | (interactive) | 789 | (interactive) |
| 790 | ;; If not in active mode do nothing but don't complain because this | 790 | ;; If not in active mode do nothing but don't complain because this |
| 791 | ;; may be bound to a hook. | 791 | ;; may be bound to a hook. |
| @@ -800,8 +800,7 @@ buffer to be saved): | |||
| 800 | ;; and display them all if active | 800 | ;; and display them all if active |
| 801 | (if (eq highlight-changes-mode 'active) | 801 | (if (eq highlight-changes-mode 'active) |
| 802 | (hilit-chg-display-changes)))) | 802 | (hilit-chg-display-changes)))) |
| 803 | ;; This always returns nil so it is safe to use in | 803 | ;; This always returns nil so it is safe to use in write-file-functions |
| 804 | ;; local-write-file-hook | ||
| 805 | nil) | 804 | nil) |
| 806 | 805 | ||
| 807 | ;; ======================================================================== | 806 | ;; ======================================================================== |
| @@ -886,7 +885,7 @@ The default is the current buffer and the one in the next window. | |||
| 886 | If either buffer is modified and is visiting a file, you are prompted | 885 | If either buffer is modified and is visiting a file, you are prompted |
| 887 | to save the file. | 886 | to save the file. |
| 888 | 887 | ||
| 889 | Unless the buffer is unmodified and visiting a file, the buffer is | 888 | Unless the buffer is unmodified and visiting a file, the buffer is |
| 890 | written to a temporary file for comparison. | 889 | written to a temporary file for comparison. |
| 891 | 890 | ||
| 892 | If a buffer is read-only, differences will be highlighted but no property | 891 | If a buffer is read-only, differences will be highlighted but no property |
| @@ -1110,9 +1109,9 @@ variable `highlight-changes-global-changes-existing-buffers' is non-nil). | |||
| 1110 | 1109 | ||
| 1111 | A buffer is appropriate for Highlight Changes mode if all these are true: | 1110 | A buffer is appropriate for Highlight Changes mode if all these are true: |
| 1112 | - the buffer is not a special buffer (one whose name begins with | 1111 | - the buffer is not a special buffer (one whose name begins with |
| 1113 | `*' or ` ') | 1112 | `*' or ` '), |
| 1114 | - the buffer's mode is suitable as per variable | 1113 | - the buffer's mode is suitable as per variable |
| 1115 | `highlight-changes-global-modes' | 1114 | `highlight-changes-global-modes', |
| 1116 | - Highlight Changes mode is not already on for this buffer. | 1115 | - Highlight Changes mode is not already on for this buffer. |
| 1117 | 1116 | ||
| 1118 | This function is called from `hilit-chg-update-all-buffers' or | 1117 | This function is called from `hilit-chg-update-all-buffers' or |