changeset 102282:a0415be90111

(rmail-summary-mark-seen): Add option to mark as unseen. (rmail-summary-rmail-update): Store a position in rmail-summary-put-back-unseen rather than just a flag, and use it to put back the "-" mark in the summary.
author Glenn Morris <rgm@gnu.org>
date Thu, 26 Feb 2009 08:45:09 +0000
parents 36c99a7b8c3d
children 43221c2f4272
files lisp/ChangeLog lisp/mail/rmailsum.el
diffstat 2 files changed, 18 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Feb 26 08:29:13 2009 +0000
+++ b/lisp/ChangeLog	Thu Feb 26 08:45:09 2009 +0000
@@ -2,6 +2,10 @@
 
 	* mail/rmailsum.el (rmail-summary-rmail-update):
 	Use rmail-message-unseen-p.  (Bug#2477)
+	(rmail-summary-mark-seen): Add option to mark as unseen.
+	(rmail-summary-rmail-update): Store a position in
+	rmail-summary-put-back-unseen rather than just a flag, and use it to put
+	back the "-" mark in the summary.
 
 	* progmodes/cc-vars.el (c-style-variables-are-local-p):
 	Mark as safe if boolean.  (Bug#2197)
--- a/lisp/mail/rmailsum.el	Thu Feb 26 08:29:13 2009 +0000
+++ b/lisp/mail/rmailsum.el	Thu Feb 26 08:45:09 2009 +0000
@@ -886,19 +886,20 @@
   (add-hook 'post-command-hook 'rmail-summary-rmail-update nil t)
   (setq revert-buffer-function 'rmail-update-summary))
 
-(defun rmail-summary-mark-seen (n &optional nomove)
+(defun rmail-summary-mark-seen (n &optional nomove unseen)
   "Remove the unseen mark from the current message, update the summary vector.
 N is the number of the current message.  Optional argument NOMOVE
-non-nil means we are already at the right column."
+non-nil means we are already at the right column.  Optional argument
+UNSEEN non-nil means mark the message as unseen."
   (save-excursion
     (unless nomove
       (beginning-of-line)
       (skip-chars-forward " ")
       (skip-chars-forward "0-9"))
-    (when (char-equal (following-char) ?-)
+    (when (char-equal (following-char) (if unseen ?\s ?-))
       (let ((buffer-read-only nil))
 	(delete-char 1)
-	(insert " "))
+	(insert (if unseen "-" " ")))
       (let ((line (buffer-substring-no-properties (line-beginning-position)
 						  (line-beginning-position 2))))
       (with-current-buffer rmail-buffer
@@ -936,18 +937,21 @@
 	    (let ((window (get-buffer-window rmail-buffer t))
 		  (owin (selected-window)))
 	      (if isearch-mode
-		  (save-excursion
-		    (set-buffer rmail-buffer)
+		  (progn
 		    ;; If we first saw the previous message in this search,
 		    ;; and we have gone to a different message while searching,
 		    ;; put back `unseen' on the former one.
-		    (if rmail-summary-put-back-unseen
-			(rmail-set-attribute rmail-unseen-attr-index t
-					     rmail-current-message))
+		    (when rmail-summary-put-back-unseen
+		      (rmail-set-attribute rmail-unseen-attr-index t
+					   rmail-current-message)
+		      (save-excursion
+			(goto-char rmail-summary-put-back-unseen)
+			(rmail-summary-mark-seen rmail-current-message t t)))
 		    ;; Arrange to do that later, for the new current message,
 		    ;; if it still has `unseen'.
 		    (setq rmail-summary-put-back-unseen
-			  (rmail-message-unseen-p msg-num)))
+			  (if (rmail-message-unseen-p msg-num)
+			      (point))))
 		(setq rmail-summary-put-back-unseen nil))
 	      ;; Go to the desired message.
 	      (setq rmail-current-message msg-num)