comparison lisp/mail/rmailsum.el @ 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 882894a8c217
children bac8e17d51b3
comparison
equal deleted inserted replaced
6421:db0bbe836298 6422:401da3d11995
720 '("Previous" . rmail-summary-previous-all)) 720 '("Previous" . rmail-summary-previous-all))
721 721
722 (define-key rmail-summary-mode-map [menu-bar move next] 722 (define-key rmail-summary-mode-map [menu-bar move next]
723 '("Next" . rmail-summary-next-all)) 723 '("Next" . rmail-summary-next-all))
724 724
725 (defvar rmail-summary-overlay nil)
726
725 (defun rmail-summary-goto-msg (&optional n nowarn skip-rmail) 727 (defun rmail-summary-goto-msg (&optional n nowarn skip-rmail)
726 (interactive "P") 728 (interactive "P")
727 (if (consp n) (setq n (prefix-numeric-value n))) 729 (if (consp n) (setq n (prefix-numeric-value n)))
728 (if (eobp) (forward-line -1)) 730 (if (eobp) (forward-line -1))
729 (beginning-of-line) 731 (beginning-of-line)
730 (let ((buf rmail-buffer) 732 (let ((buf rmail-buffer)
731 (cur (point)) 733 (cur (point))
734 message-not-found
732 (curmsg (string-to-int 735 (curmsg (string-to-int
733 (buffer-substring (point) 736 (buffer-substring (point)
734 (min (point-max) (+ 5 (point))))))) 737 (min (point-max) (+ 5 (point)))))))
738 ;; If message number N was specified, find that message's line
739 ;; or set message-not-found.
740 ;; If N wasn't specified or that message can't be found.
741 ;; set N by default.
735 (if (not n) 742 (if (not n)
736 (setq n curmsg) 743 (setq n curmsg)
737 (if (< n 1) 744 (if (< n 1)
738 (progn (message "No preceding message") 745 (progn (message "No preceding message")
739 (setq n 1))) 746 (setq n 1)))
743 (rmail-summary-goto-msg))) 750 (rmail-summary-goto-msg)))
744 (goto-char (point-min)) 751 (goto-char (point-min))
745 (if (not (re-search-forward (concat "^ *" (int-to-string n)) nil t)) 752 (if (not (re-search-forward (concat "^ *" (int-to-string n)) nil t))
746 (progn (or nowarn (message "Message %d not found" n)) 753 (progn (or nowarn (message "Message %d not found" n))
747 (setq n curmsg) 754 (setq n curmsg)
755 (setq message-not-found t)
748 (goto-char cur)))) 756 (goto-char cur))))
749 (beginning-of-line) 757 (beginning-of-line)
750 (skip-chars-forward " ") 758 (skip-chars-forward " ")
751 (skip-chars-forward "0-9") 759 (skip-chars-forward "0-9")
752 (save-excursion (if (= (following-char) ?-) 760 (save-excursion (if (= (following-char) ?-)
753 (let ((buffer-read-only nil)) 761 (let ((buffer-read-only nil))
754 (delete-char 1) 762 (delete-char 1)
755 (insert " ")))) 763 (insert " "))))
764 ;; Make sure we have an overlay to use.
765 (or rmail-summary-overlay
766 (progn
767 (make-local-variable 'rmail-summary-overlay)
768 (setq rmail-summary-overlay (make-overlay (point) (point)))))
769 ;; If this message is in the summary, use the overlay to highlight it.
770 ;; Otherwise, don't highlight anything.
771 (if message-not-found
772 (overlay-put rmail-summary-overlay 'face nil)
773 (move-overlay rmail-summary-overlay
774 (save-excursion (beginning-of-line) (1+ (point)))
775 (point))
776 (overlay-put rmail-summary-overlay 'face 'highlight))
756 (beginning-of-line) 777 (beginning-of-line)
757 (if skip-rmail 778 (if skip-rmail
758 nil 779 nil
759 (let ((selwin (selected-window))) 780 (let ((selwin (selected-window)))
760 (unwind-protect 781 (unwind-protect