changeset 6422:401da3d11995

(rmail-summary-goto-msg): Highlight message number of current message.
author Richard M. Stallman <rms@gnu.org>
date Sat, 19 Mar 1994 05:32:26 +0000
parents db0bbe836298
children 5f52d469e0c8
files lisp/mail/rmailsum.el
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/rmailsum.el	Sat Mar 19 04:32:52 1994 +0000
+++ b/lisp/mail/rmailsum.el	Sat Mar 19 05:32:26 1994 +0000
@@ -722,6 +722,8 @@
 (define-key rmail-summary-mode-map [menu-bar move next]
   '("Next" . rmail-summary-next-all))
 
+(defvar rmail-summary-overlay nil)
+
 (defun rmail-summary-goto-msg (&optional n nowarn skip-rmail)
   (interactive "P")
   (if (consp n) (setq n (prefix-numeric-value n)))
@@ -729,9 +731,14 @@
   (beginning-of-line)
   (let ((buf rmail-buffer)
 	(cur (point))
+	message-not-found
 	(curmsg (string-to-int
 		 (buffer-substring (point)
 				   (min (point-max) (+ 5 (point)))))))
+    ;; If message number N was specified, find that message's line
+    ;; or set message-not-found.
+    ;; If N wasn't specified or that message can't be found.
+    ;; set N by default.
     (if (not n)
 	(setq n curmsg)
       (if (< n 1)
@@ -745,6 +752,7 @@
       (if (not (re-search-forward (concat "^ *" (int-to-string n)) nil t))
 	  (progn (or nowarn (message "Message %d not found" n))
 		 (setq n curmsg)
+		 (setq message-not-found t)
 		 (goto-char cur))))
     (beginning-of-line)
     (skip-chars-forward " ")
@@ -753,6 +761,19 @@
 			(let ((buffer-read-only nil))
 			  (delete-char 1)
 			  (insert " "))))
+    ;; Make sure we have an overlay to use.
+    (or rmail-summary-overlay
+	(progn
+	  (make-local-variable 'rmail-summary-overlay)
+	  (setq rmail-summary-overlay (make-overlay (point) (point)))))
+    ;; If this message is in the summary, use the overlay to highlight it.
+    ;; Otherwise, don't highlight anything.
+    (if message-not-found
+	(overlay-put rmail-summary-overlay 'face nil)
+      (move-overlay rmail-summary-overlay
+		    (save-excursion (beginning-of-line) (1+ (point)))
+		    (point))
+      (overlay-put rmail-summary-overlay 'face 'highlight))
     (beginning-of-line)
     (if skip-rmail
 	nil