From: Richard M. Stallman Date: Sun, 24 Apr 1994 05:10:51 +0000 (+0000) Subject: (rmail-show-message): Use overlays, not text properties. X-Git-Tag: emacs-19.34~8792 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=24db549c643991e462039d0d8908f32c4bf2171a;p=emacs.git (rmail-show-message): Use overlays, not text properties. (rmail-overlay-list): New variable. (rmail-mode): Make it local. --- diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el index 16b11d00caa..275367808fe 100644 --- a/lisp/mail/rmail.el +++ b/lisp/mail/rmail.el @@ -125,6 +125,8 @@ Called with region narrowed to the message, including headers.") (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 @@ Instead, these commands are available: (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 @@ If summary buffer is currently displayed, update current message there also." ;; 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