aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2009-01-28 02:50:41 +0000
committerGlenn Morris2009-01-28 02:50:41 +0000
commit9940a3eca7a5076caa1664aad01dc3095ace7b08 (patch)
tree221220f90107c4968d1d812fb3c29a00396d8718
parent3ea5d765e79601c6fe4988ed7d11cd6d4117bd36 (diff)
downloademacs-9940a3eca7a5076caa1664aad01dc3095ace7b08.tar.gz
emacs-9940a3eca7a5076caa1664aad01dc3095ace7b08.zip
(rmail-expunge-and-save): Always show a message,
even when called from the summary. (Bug#2075) (rmail-no-mail-p): New func, extracted from rmail-show-message-maybe. (rmail-show-message-maybe): Use rmail-no-mail-p. (rmail-show-message): If empty folder, do nothing. (Bug#2076)
-rw-r--r--lisp/ChangeLog24
-rw-r--r--lisp/mail/rmail.el182
2 files changed, 117 insertions, 89 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 592fc35363d..144e208ae83 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,24 @@
12009-01-28 Glenn Morris <rgm@gnu.org>
2
3 * mail/rmail.el (rmail-expunge-and-save): Always show a message,
4 even when called from the summary. (Bug#2075)
5 (rmail-no-mail-p): New func, extracted from rmail-show-message-maybe.
6 (rmail-show-message-maybe): Use rmail-no-mail-p.
7 (rmail-show-message): If empty folder, do nothing. (Bug#2076)
8
9 (rmail-get-labels): Separate status and label fields with a semicolon,
10 rather than a comma, for consistency with old Rmail.
11
12 * mail/rmailsum.el (rmail-message-recipients-p-1): Don't bother
13 starting from the beginning, since mail-fetch-field does not care.
14 (rmail-create-summary-line): Fix unseen handling. (Bug#2089)
15 (rmail-get-summary-status): New name for old rmail-get-summary-labels.
16 (rmail-get-summary-labels): New function. Returns labels rather than
17 status (edited, etc).
18 (rmail-create-summary): Insert an extra space after the status
19 flags, for consistency with old rmail, and with current
20 rmail-summary-font-lock-keywords.
21
12009-01-28 Chong Yidong <cyd@stupidchicken.com> 222009-01-28 Chong Yidong <cyd@stupidchicken.com>
2 23
3 * progmodes/perl-mode.el (perl-indent-line-command): Call 24 * progmodes/perl-mode.el (perl-indent-line-command): Call
@@ -84,7 +105,8 @@
84 (batch-unrmail, unrmail): Doc fix. 105 (batch-unrmail, unrmail): Doc fix.
85 106
86 * mail/rmailsum.el (rmail-message-recipients-p-1) 107 * mail/rmailsum.el (rmail-message-recipients-p-1)
87 (rmail-message-regexp-p-1): Avoid clobbering the mark. 108 (rmail-message-regexp-p-1): Ensure searches start from the
109 beginning of the header.
88 110
892009-01-27 Chong Yidong <cyd@stupidchicken.com> 1112009-01-27 Chong Yidong <cyd@stupidchicken.com>
90 112
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 8f65ba293fe..efd3044b653 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1392,8 +1392,8 @@ If so restore the actual mbox message collection."
1392 (rmail-swap-buffers-maybe) 1392 (rmail-swap-buffers-maybe)
1393 (save-buffer) 1393 (save-buffer)
1394 (if (rmail-summary-exists) 1394 (if (rmail-summary-exists)
1395 (rmail-select-summary (set-buffer-modified-p nil)) 1395 (rmail-select-summary (set-buffer-modified-p nil)))
1396 (rmail-show-message))) 1396 (rmail-show-message))
1397 1397
1398(defun rmail-quit () 1398(defun rmail-quit ()
1399 "Quit out of RMAIL. 1399 "Quit out of RMAIL.
@@ -2051,7 +2051,8 @@ If nil, that means the current message."
2051 (if (string= keywords "") 2051 (if (string= keywords "")
2052 (setq keywords nil)) 2052 (setq keywords nil))
2053 (cond 2053 (cond
2054 ((and attr-names keywords) (concat " " attr-names ", " keywords)) 2054 ;; FIXME ? old rmail did not have spaces in the comma-separated lists.
2055 ((and attr-names keywords) (concat " " attr-names "; " keywords))
2055 (attr-names (concat " " attr-names)) 2056 (attr-names (concat " " attr-names))
2056 (keywords (concat " " keywords)) 2057 (keywords (concat " " keywords))
2057 (t "")))) 2058 (t ""))))
@@ -2150,14 +2151,14 @@ This function assumes the Rmail buffer is unswapped."
2150 (save-excursion 2151 (save-excursion
2151 (save-restriction 2152 (save-restriction
2152 (let ((start (rmail-msgbeg msg)) 2153 (let ((start (rmail-msgbeg msg))
2153 limit) 2154 limit)
2154 (widen) 2155 (widen)
2155 (goto-char start) 2156 (goto-char start)
2156 (setq limit (search-forward "\n\n" (rmail-msgend msg) t)) 2157 (setq limit (search-forward "\n\n" (rmail-msgend msg) t))
2157 (goto-char start) 2158 (goto-char start)
2158 (and limit 2159 (and limit
2159 (search-forward (concat rmail-attribute-header ": ") limit t) 2160 (search-forward (concat rmail-attribute-header ": ") limit t)
2160 (looking-at attrs)))))) 2161 (looking-at attrs))))))
2161 2162
2162(defun rmail-message-unseen-p (msgnum) 2163(defun rmail-message-unseen-p (msgnum)
2163 "Test the unseen attribute for message MSGNUM. 2164 "Test the unseen attribute for message MSGNUM.
@@ -2429,6 +2430,14 @@ Ask the user whether to add that list name to `mail-mailing-lists'."
2429 (rmail-swap-buffers-maybe) 2430 (rmail-swap-buffers-maybe)
2430 (widen)) 2431 (widen))
2431 2432
2433(defun rmail-no-mail-p ()
2434 "Return nil if there is mail, else \"No mail.\"."
2435 (if (zerop rmail-total-messages)
2436 (save-excursion
2437 (with-current-buffer rmail-view-buffer
2438 (erase-buffer)
2439 "No mail."))))
2440
2432(defun rmail-show-message-maybe (&optional n no-summary) 2441(defun rmail-show-message-maybe (&optional n no-summary)
2433 "Show message number N (prefix argument), counting from start of file. 2442 "Show message number N (prefix argument), counting from start of file.
2434If summary buffer is currently displayed, update current message there also." 2443If summary buffer is currently displayed, update current message there also."
@@ -2439,12 +2448,8 @@ If summary buffer is currently displayed, update current message there also."
2439 (rmail-maybe-set-message-counters) 2448 (rmail-maybe-set-message-counters)
2440 (widen) 2449 (widen)
2441 (let ((msgnum (or n rmail-current-message)) 2450 (let ((msgnum (or n rmail-current-message))
2442 blurb) 2451 (blurb (rmail-no-mail-p)))
2443 (if (zerop rmail-total-messages) 2452 (unless blurb
2444 (save-excursion
2445 (with-current-buffer rmail-view-buffer
2446 (erase-buffer)
2447 (setq blurb "No mail.")))
2448 (setq blurb (rmail-show-message msgnum)) 2453 (setq blurb (rmail-show-message msgnum))
2449 (when mail-mailing-lists 2454 (when mail-mailing-lists
2450 (rmail-unknown-mail-followup-to)) 2455 (rmail-unknown-mail-followup-to))
@@ -2484,77 +2489,78 @@ The current mail message becomes the message displayed."
2484 blurb beg end body-start coding-system character-coding is-text-message) 2489 blurb beg end body-start coding-system character-coding is-text-message)
2485 (if (not msg) 2490 (if (not msg)
2486 (setq msg rmail-current-message)) 2491 (setq msg rmail-current-message))
2487 (cond ((<= msg 0) 2492 (unless (setq blurb (rmail-no-mail-p))
2488 (setq msg 1 2493 (cond ((<= msg 0)
2489 rmail-current-message 1 2494 (setq msg 1
2490 blurb "No previous message")) 2495 rmail-current-message 1
2491 ((> msg rmail-total-messages) 2496 blurb "No previous message"))
2492 (setq msg rmail-total-messages 2497 ((> msg rmail-total-messages)
2493 rmail-current-message rmail-total-messages 2498 (setq msg rmail-total-messages
2494 blurb "No following message")) 2499 rmail-current-message rmail-total-messages
2495 (t (setq rmail-current-message msg))) 2500 blurb "No following message"))
2496 (with-current-buffer rmail-buffer 2501 (t (setq rmail-current-message msg)))
2497 ;; Mark the message as seen, bracket the message in the mail 2502 (with-current-buffer rmail-buffer
2498 ;; buffer and determine the coding system the transfer encoding. 2503 ;; Mark the message as seen, bracket the message in the mail
2499 (rmail-set-attribute rmail-unseen-attr-index nil) 2504 ;; buffer and determine the coding system the transfer encoding.
2500 (rmail-swap-buffers-maybe) 2505 (rmail-set-attribute rmail-unseen-attr-index nil)
2501 (setq beg (rmail-msgbeg msg) 2506 (rmail-swap-buffers-maybe)
2502 end (rmail-msgend msg)) 2507 (setq beg (rmail-msgbeg msg)
2503 (narrow-to-region beg end) 2508 end (rmail-msgend msg))
2504 (goto-char beg) 2509 (narrow-to-region beg end)
2505 (setq body-start (search-forward "\n\n" nil t)) 2510 (goto-char beg)
2506 (narrow-to-region beg (point)) 2511 (setq body-start (search-forward "\n\n" nil t))
2507 (goto-char beg) 2512 (narrow-to-region beg (point))
2508 (setq character-coding (mail-fetch-field "content-transfer-encoding") 2513 (goto-char beg)
2509 is-text-message (rmail-is-text-p) 2514 (setq character-coding (mail-fetch-field "content-transfer-encoding")
2510 coding-system (rmail-get-coding-system)) 2515 is-text-message (rmail-is-text-p)
2511 (if character-coding 2516 coding-system (rmail-get-coding-system))
2512 (setq character-coding (downcase character-coding))) 2517 (if character-coding
2513 (narrow-to-region beg end) 2518 (setq character-coding (downcase character-coding)))
2514 ;; Decode the message body into an empty view buffer using a 2519 (narrow-to-region beg end)
2515 ;; unibyte temporary buffer where the character decoding takes 2520 ;; Decode the message body into an empty view buffer using a
2516 ;; place. 2521 ;; unibyte temporary buffer where the character decoding takes
2517 (with-current-buffer rmail-view-buffer 2522 ;; place.
2518 (erase-buffer)) 2523 (with-current-buffer rmail-view-buffer
2519 (if (null character-coding) 2524 (erase-buffer))
2520 ;; Do it directly since that is fast. 2525 (if (null character-coding)
2521 (rmail-decode-region body-start end coding-system view-buf) 2526 ;; Do it directly since that is fast.
2522 ;; Can this be done directly, skipping the temp buffer? 2527 (rmail-decode-region body-start end coding-system view-buf)
2523 (with-temp-buffer 2528 ;; Can this be done directly, skipping the temp buffer?
2524 (set-buffer-multibyte nil) 2529 (with-temp-buffer
2525 (insert-buffer-substring mbox-buf body-start end) 2530 (set-buffer-multibyte nil)
2526 (cond 2531 (insert-buffer-substring mbox-buf body-start end)
2527 ((string= character-coding "quoted-printable") 2532 (cond
2528 (mail-unquote-printable-region (point-min) (point-max))) 2533 ((string= character-coding "quoted-printable")
2529 ((and (string= character-coding "base64") is-text-message) 2534 (mail-unquote-printable-region (point-min) (point-max)))
2530 (base64-decode-region (point-min) (point-max))) 2535 ((and (string= character-coding "base64") is-text-message)
2531 ((eq character-coding 'uuencode) 2536 (base64-decode-region (point-min) (point-max)))
2532 (error "Not supported yet")) 2537 ((eq character-coding 'uuencode)
2533 (t)) 2538 (error "Not supported yet"))
2534 (rmail-decode-region (point-min) (point-max) 2539 (t))
2535 coding-system view-buf))) 2540 (rmail-decode-region (point-min) (point-max)
2536 ;; Copy the headers to the front of the message view buffer. 2541 coding-system view-buf)))
2537 (with-current-buffer rmail-view-buffer 2542 ;; Copy the headers to the front of the message view buffer.
2538 (goto-char (point-min))) 2543 (with-current-buffer rmail-view-buffer
2539 (rmail-copy-headers beg end) 2544 (goto-char (point-min)))
2540 ;; Add the separator (blank line) between headers and body; 2545 (rmail-copy-headers beg end)
2541 ;; highlight the message, activate any URL like text and add 2546 ;; Add the separator (blank line) between headers and body;
2542 ;; special highlighting for and quoted material. 2547 ;; highlight the message, activate any URL like text and add
2543 (with-current-buffer rmail-view-buffer 2548 ;; special highlighting for and quoted material.
2544 (insert "\n") 2549 (with-current-buffer rmail-view-buffer
2545 (goto-char (point-min)) 2550 (insert "\n")
2546 (rmail-highlight-headers) 2551 (goto-char (point-min))
2547 ;(rmail-activate-urls) 2552 (rmail-highlight-headers)
2548 ;(rmail-process-quoted-material) 2553 ;(rmail-activate-urls)
2549 ) 2554 ;(rmail-process-quoted-material)
2550 ;; Update the mode-line with message status information and swap 2555 )
2551 ;; the view buffer/mail buffer contents. 2556 ;; Update the mode-line with message status information and swap
2552 (rmail-display-labels) 2557 ;; the view buffer/mail buffer contents.
2553 (let ((modp (buffer-modified-p))) 2558 (rmail-display-labels)
2554 (buffer-swap-text rmail-view-buffer) 2559 (let ((modp (buffer-modified-p)))
2555 (set-buffer-modified-p modp)) 2560 (buffer-swap-text rmail-view-buffer)
2556 (setq rmail-buffer-swapped t) 2561 (set-buffer-modified-p modp))
2557 (run-hooks 'rmail-show-message-hook)) 2562 (setq rmail-buffer-swapped t)
2563 (run-hooks 'rmail-show-message-hook)))
2558 blurb)) 2564 blurb))
2559 2565
2560(defun rmail-copy-headers (beg end &optional ignored-headers) 2566(defun rmail-copy-headers (beg end &optional ignored-headers)