changeset 7061:9f27a57b7662

(rmail-show-message): Use overlays, not text properties. (rmail-overlay-list): New variable. (rmail-mode): Make it local.
author Richard M. Stallman <rms@gnu.org>
date Sun, 24 Apr 1994 05:10:51 +0000
parents 58d613f69b39
children 6356b8d3144e
files lisp/mail/rmail.el
diffstat 1 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmail.el	Sun Apr 24 03:51:13 1994 +0000
+++ b/lisp/mail/rmail.el	Sun Apr 24 05:10:51 1994 +0000
@@ -125,6 +125,8 @@
 (defvar rmail-message-vector nil)
 (defvar rmail-deleted-vector nil)
 
+(defvar rmail-overlay-list nil)
+
 ;; These are used by autoloaded rmail-summary.
 
 (defvar rmail-summary-buffer nil)
@@ -575,6 +577,8 @@
   (make-local-variable 'rmail-total-messages)
   (make-local-variable 'require-final-newline)
   (setq require-final-newline nil)
+  (make-local-variable 'rmail-overlay-list)
+  (setq rmail-overlay-list nil)
   (make-local-variable 'version-control)
   (setq version-control 'never)
   (make-local-variable 'file-precious-flag)
@@ -1403,18 +1407,32 @@
 		  ;; Highlight with boldface if that is available.
 		  ;; Otherwise use the `highlight' face.
 		  (face (if (face-differs-from-default-p 'bold)
-			    'bold 'highlight)))
+			    'bold 'highlight))
+		  ;; List of overlays to reuse.
+		  (overlays rmail-overlay-list))
 	      (goto-char (point-min))
 	      (while (re-search-forward rmail-highlighted-headers nil t)
 		(skip-syntax-forward " ")
-		(let ((beg (point)))
+		(let ((beg (point))
+		      overlay)
 		  (while (progn (forward-line 1)
 				(looking-at "[ \t]")))
 		  ;; Back up over newline, then trailing spaces or tabs
 		  (forward-char -1)
 		  (while (member (preceding-char) '(?  ?\t))
 		    (forward-char -1))
-		  (put-text-property beg (point) 'face face))))))
+		  (if overlays
+		      ;; Reuse an overlay we already have.
+		      (progn
+			(setq overlay (car overlays)
+			      overlays (cdr overlays))
+			(move-overlay overlay beg (point)))
+		    ;; Make a new overlay and add it to
+		    ;; rmail-overlay-list.
+		    (setq overlay (make-overlay beg beg))
+		    (overlay-put overlay 'face face)
+		    (setq rmail-overlay-list
+			  (cons overlay rmail-overlay-list))))))))
 	(run-hooks 'rmail-show-message-hook)
 	;; If there is a summary buffer, try to move to this message
 	;; in that buffer.  But don't complain if this message