changeset 17936:9402fa70b738

(libc-highlight-overlay): New variable. (libc-search-index): Use an overlay for highlighting.
author Richard M. Stallman <rms@gnu.org>
date Sat, 24 May 1997 08:14:51 +0000
parents 5dbdaeeba3fe
children 4a8e23659626
files lisp/=libc.el
diffstat 1 files changed, 13 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/=libc.el	Sat May 24 08:13:06 1997 +0000
+++ b/lisp/=libc.el	Sat May 24 08:14:51 1997 +0000
@@ -44,9 +44,12 @@
   "Basename of the Info file of the GNU C Library Reference Manual.")
 
 (defvar libc-highlight-face 'highlight
-  "*Face for highlighting looked up symbol names in the Info buffer;
+  "*Face for highlighting looked up symbol names in the Info buffer.
 `nil' disables highlighting.")
 
+(defvar libc-highlight-overlay nil
+  "Overlay object used for highlighting.")
+
 (defconst libc-symbol-completions nil
   "Alist of documented C symbols.")
 
@@ -232,9 +235,15 @@
 		   ;; occurence of ITEM will be highlighted.
 		   (save-excursion
 		     (re-search-forward (regexp-quote item))
-		     (put-text-property
-		      (match-beginning 0) (match-end 0)
-		      'face libc-highlight-face)))
+		     (let ((start (match-beginning 0))
+			   (end (match-end 0)))
+		       (if (overlayp libc-highlight-overlay)
+			   (move-overlay libc-highlight-overlay
+					 start end (current-buffer))
+			 (setq libc-highlight-overlay
+			       (make-overlay start end))))
+		     (overlay-put libc-highlight-overlay
+				  'face libc-highlight-face)))
 	      (beginning-of-line)))
 	item)
     (error nil)))