[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: faq.texi
From: |
Juri Linkov |
Subject: |
Re: faq.texi |
Date: |
Fri, 17 Feb 2006 23:56:06 +0200 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux) |
>> Are you saying you wish it would highlight the matching text that it
>> finds each time?
>
> Something like that; given that it already has support for an overlay to
> indicate where it skipped over non-matching text, I'm imagining an
> extension of that functionality where it would (1) highlight matching text
> too (in a different color), and (2) not immediately delete the overlays
> (currently the overlay appears to be strictly temporary).
>
> I'm not sure the best way to delete the overlays though, if they were made
> longer-lasting.
I believe the patch below is a good way to do this. When the value of
`compare-windows-highlight' is `persistent', it requires calling
`compare-windows-dehighlight' (which can be bound to a separate key)
to delete all overlays.
Index: lisp/compare-w.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/compare-w.el,v
retrieving revision 1.33
diff -c -r1.33 compare-w.el
*** lisp/compare-w.el 6 Feb 2006 14:33:32 -0000 1.33
--- lisp/compare-w.el 17 Feb 2006 21:54:57 -0000
***************
*** 117,124 ****
:version "22.1")
(defcustom compare-windows-highlight t
! "*Non-nil means compare-windows highlights the differences."
! :type 'boolean
:group 'compare-w
:version "22.1")
--- 117,130 ----
:version "22.1")
(defcustom compare-windows-highlight t
! "*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,135 ****
--- 136,143 ----
(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,363 ****
(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)))
(defun compare-windows-dehighlight ()
"Remove highlighting created by `compare-windows-highlight'."
(interactive)
(remove-hook 'pre-command-hook 'compare-windows-dehighlight)
(and compare-windows-overlay1 (delete-overlay compare-windows-overlay1))
(and compare-windows-overlay2 (delete-overlay compare-windows-overlay2)))
--- 381,402 ----
(overlay-put compare-windows-overlay2 'face 'compare-windows)
(overlay-put compare-windows-overlay2 'priority 1000))
(overlay-put compare-windows-overlay2 'window w2)
! (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)))
--
Juri Linkov
http://www.jurta.org/emacs/
- Re: faq.texi, (continued)
- Re: faq.texi, Miles Bader, 2006/02/14
- Re: faq.texi, Alan Mackenzie, 2006/02/15
- RE: faq.texi, Drew Adams, 2006/02/15
- RE: faq.texi, Alan Mackenzie, 2006/02/15
- Re: faq.texi, Miles Bader, 2006/02/15
- RE: faq.texi, Drew Adams, 2006/02/15
- Re: faq.texi, Richard M. Stallman, 2006/02/15
- Re: faq.texi, Miles Bader, 2006/02/16
- Re: faq.texi, Richard M. Stallman, 2006/02/16
- Re: faq.texi, Miles Bader, 2006/02/16
- Re: faq.texi,
Juri Linkov <=
- Re: faq.texi, Richard M. Stallman, 2006/02/18
- Re: faq.texi, Richard M. Stallman, 2006/02/17
- Re: faq.texi, Alan Mackenzie, 2006/02/16
- RE: faq.texi, Drew Adams, 2006/02/16
- Re: faq.texi, Juri Linkov, 2006/02/17
- RE: faq.texi, Drew Adams, 2006/02/17
- Re: faq.texi, Andreas Schwab, 2006/02/16
- Re: faq.texi, Juri Linkov, 2006/02/17
- Re: faq.texi, Miles Bader, 2006/02/18
- Re: faq.texi, Richard M. Stallman, 2006/02/16