-;;; elmo-mime.el -- MIME module for ELMO.
+;;; elmo-mime.el --- MIME module for ELMO.
;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
;;
;;; Commentary:
-;;
+;;
;;; Code:
-;;
+;;
(require 'elmo-vars)
(require 'mmbuffer)
(require 'mmimap)
(function :tag "Function"))
:group 'elmo)
+(defcustom elmo-mime-display-as-is-coding-system (if (boundp 'MULE)
+ '*autoconv* 'undecided)
+ "*Coding system used when message is displayed as is."
+ :type 'symbol
+ :group 'elmo)
+
(luna-define-method initialize-instance :after ((entity mime-elmo-buffer-entity)
&rest init-args)
entity)
(mode-obj (mime-find-field-presentation-method 'wide))
field-decoder
f-b p f-e field-name field field-body
- vf-alist (sl sort-fields))
+ vf-alist (sl sort-fields))
(save-excursion
(set-buffer buffer)
(save-restriction
field-body (buffer-substring p f-e)
field-decoder (inline (mime-find-field-decoder-internal
field mode-obj)))
- (setq vf-alist (append (list
- (cons field-name
- (list field-body field-decoder)))
- vf-alist))))
- (and vf-alist
- (setq vf-alist
- (sort vf-alist
- (function (lambda (s d)
- (let ((n 0) re
- (sf (car s))
- (df (car d)))
- (catch 'done
- (while (setq re (nth n sl))
- (setq n (1+ n))
- (and (string-match re sf)
- (throw 'done t))
- (and (string-match re df)
- (throw 'done nil)))
- t)))))))
- (with-current-buffer the-buf
- (while vf-alist
- (let* ((vf (car vf-alist))
- (field-name (car vf))
- (field-body (car (cdr vf)))
- (field-decoder (car (cdr (cdr vf)))))
- (insert field-name)
+ (setq vf-alist (append (list
+ (cons field-name
+ (list field-body field-decoder)))
+ vf-alist))))
+ (and vf-alist
+ (setq vf-alist
+ (sort vf-alist
+ (function (lambda (s d)
+ (let ((n 0) re
+ (sf (car s))
+ (df (car d)))
+ (catch 'done
+ (while (setq re (nth n sl))
+ (setq n (1+ n))
+ (and (string-match re sf)
+ (throw 'done t))
+ (and (string-match re df)
+ (throw 'done nil)))
+ t)))))))
+ (with-current-buffer the-buf
+ (while vf-alist
+ (let* ((vf (car vf-alist))
+ (field-name (car vf))
+ (field-body (car (cdr vf)))
+ (field-decoder (car (cdr (cdr vf)))))
+ (insert field-name)
(insert (if field-decoder
(funcall field-decoder field-body
- (string-width field-name)
+ (string-width field-name)
(if (functionp elmo-mime-header-max-column)
(funcall elmo-mime-header-max-column)
elmo-mime-header-max-column))
;; Don't decode
field-body))
- (insert "\n"))
- (setq vf-alist (cdr vf-alist)))
+ (insert "\n"))
+ (setq vf-alist (cdr vf-alist)))
(run-hooks 'mmelmo-header-inserted-hook))))))
(luna-define-generic elmo-mime-insert-sorted-header (entity
p-max (point-max))
(set-buffer the-buf)
(elmo-mime-insert-header-from-buffer buf p-min p-max
- invisible-fields visible-fields))))
+ invisible-fields
+ visible-fields
+ sorted-fields))))
(luna-define-method mime-insert-text-content :around
((entity mime-elmo-buffer-entity))
rawbuf))
(defun elmo-mime-message-display (folder number viewbuf rawbuf original-mode
- &optional ignore-cache unread)
+ &optional ignore-cache unread keymap)
"Display MIME message.
A message in the FOLDER with NUMBER is displayed on the VIEWBUF using RAWBUF.
VIEWBUF is a view buffer and RAWBUF is a raw buffer.
keep it as unread.
Return non-nil if not entire message was fetched."
(let (mime-display-header-hook ; Do nothing.
+ (elmo-message-displaying t)
entity strategy)
(setq entity (elmo-msgdb-overview-get-entity number
(elmo-folder-msgdb
'elmo-buffer)
(elmo-make-mime-message-location
folder number strategy rawbuf unread))
- viewbuf nil nil original-mode)
+ viewbuf nil keymap
+ original-mode)
(if strategy
(or (elmo-fetch-strategy-use-cache strategy)
(eq (elmo-fetch-strategy-entireness strategy)
'section)))))
(defun elmo-mime-display-as-is (folder number viewbuf rawbuf original-mode
- &optional ignore-cache unread)
+ &optional ignore-cache unread keymap)
"Display MIME message.
A message in the FOLDER with NUMBER is displayed on the VIEWBUF using RAWBUF.
VIEWBUF is a view buffer and RAWBUF is a raw buffer.
'elmo-buffer
(elmo-make-mime-message-location
folder number strategy rawbuf unread))
- viewbuf nil nil original-mode)
+ viewbuf nil keymap original-mode)
(elmo-fetch-strategy-use-cache strategy)))
;; Replacement of mime-display-message.
(set-buffer-multibyte nil)
(mime-insert-entity message)
(set-buffer-multibyte t)
- (decode-coding-region (point-min) (point-max) 'undecided)
+ (decode-coding-region (point-min) (point-max)
+ elmo-mime-display-as-is-coding-system)
(save-restriction
(std11-narrow-to-header)
(run-hooks 'elmo-message-header-inserted-hook))
+ ;; set original major mode for mime-preview-quit
+ (put-text-property (point-min) (point-max)
+ 'mime-view-situation
+ `((major-mode . ,original-major-mode)))
(use-local-map
(or keymap
(if default-keymap-or-function
(require 'product)
(product-provide (provide 'elmo-mime) (require 'elmo-version))
-;; elmo-mime.el ends here
\ No newline at end of file
+;; elmo-mime.el ends here