comparison lisp/mail/rmail.el @ 101644:13e00d6e6541

(rmail-toggle-header): Determine current header style using the buffer-local value of rmail-header-style in the view buffer. (rmail-show-message): Set a buffer-local value of rmail-header-style in the view buffer.
author Chong Yidong <cyd@stupidchicken.com>
date Thu, 29 Jan 2009 14:09:36 +0000
parents f2c12c2dac63
children 26b8d12cf7a4
comparison
equal deleted inserted replaced
101643:f462bd5b1637 101644:13e00d6e6541
2356 "Show original message header if pruned header currently shown, or vice versa. 2356 "Show original message header if pruned header currently shown, or vice versa.
2357 With argument ARG, show the message header pruned if ARG is greater than zero; 2357 With argument ARG, show the message header pruned if ARG is greater than zero;
2358 otherwise, show it in full." 2358 otherwise, show it in full."
2359 (interactive "P") 2359 (interactive "P")
2360 (let ((rmail-header-style 2360 (let ((rmail-header-style
2361 (cond 2361 (if (numberp arg)
2362 ((and (numberp arg) (> arg 0)) 'normal) 2362 (if (> arg 0) 'normal 'full)
2363 ((eq rmail-header-style 'full) 'normal) 2363 (with-current-buffer (if (rmail-buffers-swapped-p)
2364 (t 'full)))) 2364 rmail-view-buffer
2365 rmail-buffer)
2366 (if (eq rmail-header-style 'full) 'normal 'full)))))
2365 (rmail-show-message-maybe))) 2367 (rmail-show-message-maybe)))
2366 2368
2367 (defun rmail-beginning-of-message () 2369 (defun rmail-beginning-of-message ()
2368 "Show current message starting from the beginning." 2370 "Show current message starting from the beginning."
2369 (interactive) 2371 (interactive)
2473 Return text to display in the minibuffer if MSG is out of 2475 Return text to display in the minibuffer if MSG is out of
2474 range (displaying a reasonable choice as well), nil otherwise. 2476 range (displaying a reasonable choice as well), nil otherwise.
2475 The current mail message becomes the message displayed." 2477 The current mail message becomes the message displayed."
2476 (let ((mbox-buf rmail-buffer) 2478 (let ((mbox-buf rmail-buffer)
2477 (view-buf rmail-view-buffer) 2479 (view-buf rmail-view-buffer)
2478 blurb beg end body-start coding-system character-coding is-text-message) 2480 blurb beg end body-start coding-system character-coding
2481 is-text-message header-style)
2479 (if (not msg) 2482 (if (not msg)
2480 (setq msg rmail-current-message)) 2483 (setq msg rmail-current-message))
2481 (unless (setq blurb (rmail-no-mail-p)) 2484 (unless (setq blurb (rmail-no-mail-p))
2482 (cond ((<= msg 0) 2485 (cond ((<= msg 0)
2483 (setq msg 1 2486 (setq msg 1
2487 (setq msg rmail-total-messages 2490 (setq msg rmail-total-messages
2488 rmail-current-message rmail-total-messages 2491 rmail-current-message rmail-total-messages
2489 blurb "No following message")) 2492 blurb "No following message"))
2490 (t (setq rmail-current-message msg))) 2493 (t (setq rmail-current-message msg)))
2491 (with-current-buffer rmail-buffer 2494 (with-current-buffer rmail-buffer
2495 (setq header-style rmail-header-style)
2492 ;; Mark the message as seen, bracket the message in the mail 2496 ;; Mark the message as seen, bracket the message in the mail
2493 ;; buffer and determine the coding system the transfer encoding. 2497 ;; buffer and determine the coding system the transfer encoding.
2494 (rmail-set-attribute rmail-unseen-attr-index nil) 2498 (rmail-set-attribute rmail-unseen-attr-index nil)
2495 (rmail-swap-buffers-maybe) 2499 (rmail-swap-buffers-maybe)
2496 (setq beg (rmail-msgbeg msg) 2500 (setq beg (rmail-msgbeg msg)
2508 (narrow-to-region beg end) 2512 (narrow-to-region beg end)
2509 ;; Decode the message body into an empty view buffer using a 2513 ;; Decode the message body into an empty view buffer using a
2510 ;; unibyte temporary buffer where the character decoding takes 2514 ;; unibyte temporary buffer where the character decoding takes
2511 ;; place. 2515 ;; place.
2512 (with-current-buffer rmail-view-buffer 2516 (with-current-buffer rmail-view-buffer
2517 ;; We give the view buffer a buffer-local value of
2518 ;; rmail-header-style based on the binding in effect when
2519 ;; this function is called; `rmail-toggle-headers' can
2520 ;; inspect this value to determine how to toggle.
2521 (set (make-local-variable 'rmail-header-style) header-style)
2513 (erase-buffer)) 2522 (erase-buffer))
2514 (if (null character-coding) 2523 (if (null character-coding)
2515 ;; Do it directly since that is fast. 2524 ;; Do it directly since that is fast.
2516 (rmail-decode-region body-start end coding-system view-buf) 2525 (rmail-decode-region body-start end coding-system view-buf)
2517 ;; Can this be done directly, skipping the temp buffer? 2526 ;; Can this be done directly, skipping the temp buffer?