comparison lisp/mail/rmail.el @ 112098:40af77a50adc

Merge changes from emacs-23 branch
author Chong Yidong <cyd@stupidchicken.com>
date Sun, 02 Jan 2011 15:28:40 -0500
parents 0889087d741a f04d713b43e1
children a71f37cebb55
comparison
equal deleted inserted replaced
112045:52100bac91db 112098:40af77a50adc
2689 end (rmail-msgend msg)) 2689 end (rmail-msgend msg))
2690 (when (> (- end beg) rmail-show-message-verbose-min) 2690 (when (> (- end beg) rmail-show-message-verbose-min)
2691 (message "Showing message %d" msg)) 2691 (message "Showing message %d" msg))
2692 (narrow-to-region beg end) 2692 (narrow-to-region beg end)
2693 (goto-char beg) 2693 (goto-char beg)
2694 (with-current-buffer rmail-view-buffer
2695 ;; We give the view buffer a buffer-local value of
2696 ;; rmail-header-style based on the binding in effect when
2697 ;; this function is called; `rmail-toggle-headers' can
2698 ;; inspect this value to determine how to toggle.
2699 (set (make-local-variable 'rmail-header-style) header-style))
2694 (if (and rmail-enable-mime 2700 (if (and rmail-enable-mime
2695 (re-search-forward "mime-version: 1.0" nil t)) 2701 (re-search-forward "mime-version: 1.0" nil t))
2696 (let ((rmail-buffer mbox-buf) 2702 (let ((rmail-buffer mbox-buf)
2697 (rmail-view-buffer view-buf)) 2703 (rmail-view-buffer view-buf))
2698 (funcall rmail-show-mime-function)) 2704 (funcall rmail-show-mime-function))
2699 (setq body-start (search-forward "\n\n" nil t)) 2705 (setq body-start (search-forward "\n\n" nil t))
2700 (narrow-to-region beg (point)) 2706 (narrow-to-region beg (point))
2701 (goto-char beg) 2707 (goto-char beg)
2702 (save-excursion 2708 (save-excursion
2703 (if (re-search-forward "^X-Coding-System: *\\(.*\\)$" nil t) 2709 (if (re-search-forward "^X-Coding-System: *\\(.*\\)$" nil t)
2704 (setq coding-system (intern (match-string 1))) 2710 (setq coding-system (intern (match-string 1)))
2705 (setq coding-system (rmail-get-coding-system)))) 2711 (setq coding-system (rmail-get-coding-system))))
2706 (setq character-coding (mail-fetch-field "content-transfer-encoding") 2712 (setq character-coding (mail-fetch-field "content-transfer-encoding")
2707 is-text-message (rmail-is-text-p)) 2713 is-text-message (rmail-is-text-p))
2708 (if character-coding 2714 (if character-coding
2709 (setq character-coding (downcase character-coding))) 2715 (setq character-coding (downcase character-coding)))
2710 (narrow-to-region beg end) 2716 (narrow-to-region beg end)
2711 ;; Decode the message body into an empty view buffer using a 2717 ;; Decode the message body into an empty view buffer using a
2712 ;; unibyte temporary buffer where the character decoding takes 2718 ;; unibyte temporary buffer where the character decoding takes
2713 ;; place. 2719 ;; place.
2714 (with-current-buffer rmail-view-buffer 2720 (with-current-buffer rmail-view-buffer
2715 (erase-buffer)) 2721 (erase-buffer))
2716 (if (null character-coding) 2722 (if (null character-coding)
2717 ;; Do it directly since that is fast. 2723 ;; Do it directly since that is fast.
2718 (rmail-decode-region body-start end coding-system view-buf) 2724 (rmail-decode-region body-start end coding-system view-buf)
2719 ;; Can this be done directly, skipping the temp buffer? 2725 ;; Can this be done directly, skipping the temp buffer?
2720 (with-temp-buffer 2726 (with-temp-buffer
2721 (set-buffer-multibyte nil) 2727 (set-buffer-multibyte nil)
2722 (insert-buffer-substring mbox-buf body-start end) 2728 (insert-buffer-substring mbox-buf body-start end)
2723 (cond 2729 (cond
2724 ((string= character-coding "quoted-printable") 2730 ((string= character-coding "quoted-printable")
2725 ;; See bug#5441. 2731 ;; See bug#5441.
2726 (or (mail-unquote-printable-region (point-min) (point-max) 2732 (or (mail-unquote-printable-region (point-min) (point-max)
2727 nil t 'unibyte) 2733 nil t 'unibyte)
2728 (message "Malformed MIME quoted-printable message"))) 2734 (message "Malformed MIME quoted-printable message")))
2729 ((and (string= character-coding "base64") is-text-message) 2735 ((and (string= character-coding "base64") is-text-message)
2730 (condition-case err 2736 (condition-case err
2731 (base64-decode-region (point-min) (point-max)) 2737 (base64-decode-region (point-min) (point-max))
2732 (error (message "%s" (cdr err))))) 2738 (error (message "%s" (cdr err)))))
2733 ((eq character-coding 'uuencode) 2739 ((eq character-coding 'uuencode)
2734 (error "uuencoded messages are not supported yet")) 2740 (error "uuencoded messages are not supported yet"))
2735 (t)) 2741 (t))
2736 (rmail-decode-region (point-min) (point-max) 2742 (rmail-decode-region (point-min) (point-max)
2737 coding-system view-buf)))) 2743 coding-system view-buf)))
2738 (with-current-buffer rmail-view-buffer 2744 (with-current-buffer rmail-view-buffer
2739 ;; We give the view buffer a buffer-local value of 2745 ;; Prepare the separator (blank line) before the body.
2740 ;; rmail-header-style based on the binding in effect when 2746 (goto-char (point-min))
2741 ;; this function is called; `rmail-toggle-headers' can 2747 (insert "\n")
2742 ;; inspect this value to determine how to toggle. 2748 ;; Unquote quoted From lines
2743 (set (make-local-variable 'rmail-header-style) header-style) 2749 (while (re-search-forward "^>+From " nil t)
2744 ;; Unquote quoted From lines 2750 (beginning-of-line)
2745 (goto-char (point-min)) 2751 (delete-char 1)
2746 (while (re-search-forward "^>+From " nil t) 2752 (forward-line))
2747 (beginning-of-line) 2753 (goto-char (point-min)))
2748 (delete-char 1) 2754 ;; Copy the headers to the front of the message view buffer.
2749 (forward-line)) 2755 (rmail-copy-headers beg end))
2750 (goto-char (point-min)))
2751 ;; Copy the headers to the front of the message view buffer.
2752 (rmail-copy-headers beg end)
2753 ;; Add the separator (blank line) between headers and body;
2754 ;; highlight the message, activate any URL like text and add 2756 ;; highlight the message, activate any URL like text and add
2755 ;; special highlighting for and quoted material. 2757 ;; special highlighting for and quoted material.
2756 (with-current-buffer rmail-view-buffer 2758 (with-current-buffer rmail-view-buffer
2757 (insert "\n")
2758 (goto-char (point-min)) 2759 (goto-char (point-min))
2759 ;; Decode the headers according to RFC2047.
2760 (save-excursion
2761 (search-forward "\n\n" nil 'move)
2762 (rfc2047-decode-region (point-min) (point)))
2763 (rmail-highlight-headers) 2760 (rmail-highlight-headers)
2764 ;(rmail-activate-urls) 2761 ;(rmail-activate-urls)
2765 ;(rmail-process-quoted-material) 2762 ;(rmail-process-quoted-material)
2766 ) 2763 )
2767 ;; Update the mode-line with message status information and swap 2764 ;; Update the mode-line with message status information and swap
4287 4284
4288 \(fn N LABELS)" t nil) 4285 \(fn N LABELS)" t nil)
4289 4286
4290 ;;;*** 4287 ;;;***
4291 4288
4292 ;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "b1ce015fd919b54cc7b1d0b2155489f9") 4289 ;;;### (autoloads (rmail-mime) "rmailmm" "rmailmm.el" "5767ec9a393ef5ff12bc1a14d55c949e")
4293 ;;; Generated autoloads from rmailmm.el 4290 ;;; Generated autoloads from rmailmm.el
4294 4291
4295 (autoload 'rmail-mime "rmailmm" "\ 4292 (autoload 'rmail-mime "rmailmm" "\
4296 Process the current Rmail message as a MIME message. 4293 Toggle displaying of a MIME message.
4297 This creates a temporary \"*RMAIL*\" buffer holding a decoded 4294
4298 copy of the message. Inline content-types are handled according to 4295 The actualy behavior depends on the value of `rmail-enable-mime'.
4296
4297 If `rmail-enable-mime' is t (default), this command change the
4298 displaying of a MIME message between decoded presentation form
4299 and raw data.
4300
4301 With ARG, toggle the displaying of the current MIME entity only.
4302
4303 If `rmail-enable-mime' is nil, this creates a temporary
4304 \"*RMAIL*\" buffer holding a decoded copy of the message. Inline
4305 content-types are handled according to
4299 `rmail-mime-media-type-handlers-alist'. By default, this 4306 `rmail-mime-media-type-handlers-alist'. By default, this
4300 displays text and multipart messages, and offers to download 4307 displays text and multipart messages, and offers to download
4301 attachments as specfied by `rmail-mime-attachment-dirs-alist'. 4308 attachments as specfied by `rmail-mime-attachment-dirs-alist'.
4302 4309
4303 \(fn)" t nil) 4310 \(fn &optional ARG)" t nil)
4304 4311
4305 ;;;*** 4312 ;;;***
4306 4313
4307 ;;;### (autoloads (set-rmail-inbox-list) "rmailmsc" "rmailmsc.el" 4314 ;;;### (autoloads (set-rmail-inbox-list) "rmailmsc" "rmailmsc.el"
4308 ;;;;;; "c3575020691d5769bcf08ecc932304c3") 4315 ;;;;;; "c3575020691d5769bcf08ecc932304c3")