changeset 100756:d9d23e4f6b00

(pmail-forwarded-attr-index): Doc fix. (pmail-resent-attr-index): New variable. (pmail-attr-array): Add r for resent. (pmail-add-mbox-headers): Make 8 attributes. (pmail-set-attribute): Extend attribute line if necessary. (pmail-widen): New command. (pmail-mode-map): o is pmail-output, C-o is pmail-output-as-seen, (pmail-mode-map): c-w is pmail-widen. (pmail-change-major-mode-hook): Do nothing unless buffer-swapped-with. (pmail-show-message): Downcase character-coding.
author Richard M. Stallman <rms@gnu.org>
date Mon, 29 Dec 2008 19:16:37 +0000
parents 818664433c32
children 02ad31ca52a9
files lisp/mail/pmail.el
diffstat 1 files changed, 37 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mail/pmail.el	Mon Dec 29 19:12:22 2008 +0000
+++ b/lisp/mail/pmail.el	Mon Dec 29 19:16:37 2008 +0000
@@ -65,11 +65,14 @@
   "The index for the `retried' attribute.")
 
 (defconst pmail-forwarded-attr-index 5
-  "The index for the `stored' attribute.")
+  "The index for the `forwarded' attribute.")
 
 (defconst pmail-unseen-attr-index 6
   "The index for the `unseen' attribute.")
 
+(defconst pmail-resent-attr-index 6
+  "The index for the `resent' attribute.")
+
 (defconst pmail-attr-array
   '[(?A "answered")
     (?D "deleted")
@@ -77,7 +80,8 @@
     (?F "filed")
     (?R "retried")
     (?S "forwarded")
-    (?U "unseen")]
+    (?U "unseen")
+    (?r "resent")]
   "An array that provides a mapping between an attribute index,
 its character representation and its display representation.")
 
@@ -986,8 +990,8 @@
   (define-key pmail-mode-map "n"      'pmail-next-undeleted-message)
   (define-key pmail-mode-map "\en"    'pmail-next-message)
   (define-key pmail-mode-map "\e\C-n" 'pmail-next-labeled-message)
-  (define-key pmail-mode-map "o"      'pmail-output-to-babyl-file)
-  (define-key pmail-mode-map "\C-o"   'pmail-output)
+  (define-key pmail-mode-map "o"      'pmail-output)
+  (define-key pmail-mode-map "\C-o"   'pmail-output-as-seen)
   (define-key pmail-mode-map "p"      'pmail-previous-undeleted-message)
   (define-key pmail-mode-map "\ep"    'pmail-previous-message)
   (define-key pmail-mode-map "\e\C-p" 'pmail-previous-labeled-message)
@@ -1000,6 +1004,7 @@
   (define-key pmail-mode-map "t"      'pmail-toggle-header)
   (define-key pmail-mode-map "u"      'pmail-undelete-previous-message)
   (define-key pmail-mode-map "w"      'pmail-output-body-to-file)
+  (define-key pmail-mode-map "C-w"    'pmail-widen)
   (define-key pmail-mode-map "x"      'pmail-expunge)
   (define-key pmail-mode-map "."      'pmail-beginning-of-message)
   (define-key pmail-mode-map "/"      'pmail-end-of-message)
@@ -1276,9 +1281,10 @@
 
 (defun pmail-change-major-mode-hook ()
   ;; Bring the actual Pmail messages back into the main buffer.
-  (when (pmail-buffers-swapped-p)
-    (setq buffer-swapped-with nil)
-    (buffer-swap-text pmail-view-buffer)))
+  (if buffer-swapped-with
+      (when (pmail-buffers-swapped-p)
+	(setq buffer-swapped-with nil)
+	(buffer-swap-text pmail-view-buffer))))
   ;; Throw away the summary.
   ;;(when (buffer-live-p pmail-view-buffer) (kill-buffer pmail-view-buffer)))
 
@@ -1930,7 +1936,7 @@
     (save-restriction
       (let ((count 0)
 	    (start (point))
-	    (value "------U")
+	    (value "------U-")
 	    limit)
 	;; Detect an empty inbox file.
 	(unless (= start (point-max))
@@ -2145,13 +2151,22 @@
 		  (if (search-forward (concat pmail-attribute-header ": ") limit t)
 		      ;; If this message already records attributes,
 		      ;; just change the value for this one.
-		      (progn (forward-char attr)
-			     (when (/= value (char-after))
-			       (delete-char 1)
-			       (insert value)))
+		      (let ((missing (- (+ (point) attr) (line-end-position))))
+			;; Position point at this  attribute,
+			;; adding attributes if necessary.
+			(if (> missing 0)
+			    (progn
+			      (end-of-line)
+			      (insert-char ?- missing)
+			      (backward-char 1))
+			  (forward-char attr))
+			;; Change this attribute.
+			(when (/= value (char-after))
+			  (delete-char 1)
+			  (insert value)))
 		    ;; Otherwise add a header line to record the attributes
-		    ;; and set all but this one to nil.
-		    (let ((header-value "-------"))
+		    ;; and set all but this one to no.
+		    (let ((header-value "--------"))
 		      (aset header-value attr value)
 		      (goto-char (if limit (- limit 1) (point-max)))
 		      (insert pmail-attribute-header ": " header-value "\n"))))))
@@ -2441,6 +2456,12 @@
       (buffer-swap-text pmail-view-buffer)
       (setq buffer-swapped-with nil))))
 
+(defun pmail-widen ()
+  "Display the entire mailbox file."
+  (interactive)
+  (pmail-swap-buffers-maybe)
+  (widen))
+
 (defun pmail-show-message-maybe (&optional n no-summary)
   "Show message number N (prefix argument), counting from start of file.
 If summary buffer is currently displayed, update current message there also."
@@ -2521,6 +2542,8 @@
       (setq character-coding (mail-fetch-field "content-transfer-encoding")
 	    is-text-message (pmail-is-text-p)
 	    coding-system (pmail-get-coding-system))
+      (if character-coding
+	  (setq character-coding (downcase character-coding)))
       (widen)
       (narrow-to-region beg end)
       ;; Decode the message body into an empty view buffer using a