diff options
author | Juri Linkov <juri@jurta.org> | 2006-02-23 21:41:26 +0000 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2006-02-23 21:41:26 +0000 |
commit | 9b0f7f31c0e64d83bd379931c28d982a157da5b1 (patch) | |
tree | 424056b0752738409954cb0798779eed919ae658 /lisp/compare-w.el | |
parent | 4e6d317052ad617bd403077d391d4c86ba3aee07 (diff) | |
download | emacs-9b0f7f31c0e64d83bd379931c28d982a157da5b1.tar.gz |
(compare-windows-highlight): Add new value
`persistent' and change :type from `boolean' to `choice'.
(compare-windows-overlays1, compare-windows-overlays2):
New internal variables.
(compare-windows-highlight): If compare-windows-highlight is
`persistent', add current overlays to compare-windows-overlays[12]
instead of adding compare-windows-dehighlight to pre-command-hook.
(compare-windows-dehighlight): Delete all overlays from
compare-windows-overlays[12].
Diffstat (limited to 'lisp/compare-w.el')
-rw-r--r-- | lisp/compare-w.el | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/lisp/compare-w.el b/lisp/compare-w.el index 2d23de8c54c..e61f24a0c7c 100644 --- a/lisp/compare-w.el +++ b/lisp/compare-w.el @@ -117,8 +117,14 @@ and the value `((4) (4))' for horizontally split windows." :version "22.1") (defcustom compare-windows-highlight t - "*Non-nil means compare-windows highlights the differences." - :type 'boolean + "*Non-nil means compare-windows highlights the differences. +The value t removes highlighting immediately after invoking a command +other than `compare-windows'. +The value `persistent' leaves all highlighted differences. You can clear +out all highlighting later with the command `compare-windows-dehighlight'." + :type '(choice (const :tag "No highlighting" nil) + (const :tag "Persistent highlighting" persistent) + (other :tag "Highlight until next command" t)) :group 'compare-w :version "22.1") @@ -130,6 +136,8 @@ and the value `((4) (4))' for horizontally split windows." (defvar compare-windows-overlay1 nil) (defvar compare-windows-overlay2 nil) +(defvar compare-windows-overlays1 nil) +(defvar compare-windows-overlays2 nil) (defvar compare-windows-sync-point nil) ;;;###autoload @@ -351,13 +359,22 @@ on third call it again advances points to the next difference and so on." (overlay-put compare-windows-overlay2 'face 'compare-windows) (overlay-put compare-windows-overlay2 'priority 1000)) (overlay-put compare-windows-overlay2 'window w2) - ;; Remove highlighting before next command is executed - (add-hook 'pre-command-hook 'compare-windows-dehighlight))) + (if (not (eq compare-windows-highlight 'persistent)) + ;; Remove highlighting before next command is executed + (add-hook 'pre-command-hook 'compare-windows-dehighlight) + (when compare-windows-overlay1 + (push (copy-overlay compare-windows-overlay1) compare-windows-overlays1) + (delete-overlay compare-windows-overlay1)) + (when compare-windows-overlay2 + (push (copy-overlay compare-windows-overlay2) compare-windows-overlays2) + (delete-overlay compare-windows-overlay2))))) (defun compare-windows-dehighlight () "Remove highlighting created by `compare-windows-highlight'." (interactive) (remove-hook 'pre-command-hook 'compare-windows-dehighlight) + (mapc 'delete-overlay compare-windows-overlays1) + (mapc 'delete-overlay compare-windows-overlays2) (and compare-windows-overlay1 (delete-overlay compare-windows-overlay1)) (and compare-windows-overlay2 (delete-overlay compare-windows-overlay2))) |