From: teranisi Date: Sun, 10 Oct 2004 11:04:18 +0000 (+0000) Subject: * elmo.el (autoload): Added autoload setting for `elmo-local-flag-p'. X-Git-Tag: wl-2_12-root~62 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=5e7a63c75a4ac7e09d5e07319095400501e3bf2b;p=elisp%2Fwanderlust.git * elmo.el (autoload): Added autoload setting for `elmo-local-flag-p'. (elmo-global-flag-list): Added obsolete variable setting. * elmo-vars.el (elmo-preserved-flags): Fixed docstring. * elmo-mime.el (elmo-mime-display-header-analysis): New variable. (elmo-mime-insert-header-from-buffer): Don't decode header content when `elmo-mime-display-header-analysis' is nil. * elmo-flag.el (elmo-global-flags): Renamed from `elmo-global-flag-list' (All other related portions are changed). (elmo-local-flags): New variable. (elmo-local-flag-p): New function. (elmo-global-flag-set-internal): Cause an error when flag is not global. * wl-vars.el (wl-summary-mode-line-format-spec-alist): Changed definition for `m'. (wl-summary-mode-line-format): Add '[%m]'. (wl-message-mode-line-format-spec-alist): Ditto. (wl-summary-display-mime-mode-list): New variable. * wl-summary.el (wl-summary-buffer-display-mime-mode): Renamed from wl-summary-buffer-display-as-is. (wl-summary-buffer-display-all-header): New buffer local variable. (wl-summary-mode-map): Bind "H" to the 'wl-summary-toggle-all-header'. (wl-summary-goto-folder-subr): Setup wl-summary-buffer-display-mime-mode instead of wl-summary-buffer-display-as-is. (wl-summary-unset-persistent-mark): Don't use term 'Flag' here. (wl-summary-set-persistent-mark): Ditto. (wl-summary-set-message-buffer-or-redisplay): Just call `wl-summary-redisplay-internal' without optional arguments. (wl-summary-toggle-mime): Rewrite. (wl-summary-redisplay): Don't use `wl-summary-buffer-display-as-is'. (wl-summary-toggle-all-header): New function. (wl-summary-redisplay-internal): Treat mime mode. * wl-mime.el (wl-draft-yank-current-message-entity): Pass mode to wl-mime-preview-follow-no-mime. (wl-mime-preview-follow-no-mime): Bind elmo-mime-display-header-analysis accodring to the display-mode. * wl-message.el (wl-message-buffer-display-type): Rewrite. (wl-message-buffer-display): Changed argument name from `as-is' to `mode'. (wl-message-display-internal): Ditto; Bind elmo-mime-display-header-analysis according to the mode. (wl-message-display-internal): Put wl-message-display-mime-mode property on entire buffer. --- diff --git a/elmo/ChangeLog b/elmo/ChangeLog index 511bde4..e377e7d 100644 --- a/elmo/ChangeLog +++ b/elmo/ChangeLog @@ -1,3 +1,21 @@ +2004-10-10 Yuuichi Teranishi + + * elmo.el (autoload): Added autoload setting for `elmo-local-flag-p'. + (elmo-global-flag-list): Added obsolete variable setting. + + * elmo-vars.el (elmo-preserved-flags): Fixed docstring. + + * elmo-mime.el (elmo-mime-display-header-analysis): New variable. + (elmo-mime-insert-header-from-buffer): Don't decode header content when + `elmo-mime-display-header-analysis' is nil. + + * elmo-flag.el (elmo-global-flags): Renamed from + `elmo-global-flag-list' (All other related portions are changed). + (elmo-local-flags): New variable. + (elmo-local-flag-p): New function. + (elmo-global-flag-set-internal): Cause an error when flag is not + global. + 2004-10-04 Yuuichi Teranishi * elmo-util.el (elmo-concat-path): Treat empty path. diff --git a/elmo/elmo-flag.el b/elmo/elmo-flag.el index 3cbc30b..6e21309 100644 --- a/elmo/elmo-flag.el +++ b/elmo/elmo-flag.el @@ -30,11 +30,16 @@ (eval-when-compile (require 'cl)) ;;; Code: -(defcustom elmo-global-flag-list '(important) +(defcustom elmo-global-flags '(important) "A list of flag symbol which is managed globally by the flag folder." :type '(repeat symbol) :group 'elmo) +(defcustom elmo-local-flags '(unread any digest) + "A list of flag symbol which is not treated as global flag." + :type '(repeat symbol) + :group 'elmo) + (defvar elmo-global-flag-folder-alist nil "Internal variable to hold global-flag-folder structures.") @@ -48,7 +53,7 @@ name) (if (string-match "flag/\\([a-z]+\\)" name) (setq name (match-string 1 name)) - (setq name (symbol-name (car elmo-global-flag-list))) + (setq name (symbol-name (car elmo-global-flags))) (elmo-folder-set-name-internal folder (concat (elmo-folder-name-internal folder) "/" name))) @@ -57,8 +62,8 @@ msgdb-path) (elmo-flag-folder-set-flag-internal folder flag) (unless (elmo-global-flag-p flag) - (setq elmo-global-flag-list - (nconc elmo-global-flag-list (list flag)))) + (setq elmo-global-flags + (nconc elmo-global-flags (list flag)))) ;; must be AFTER set flag slot. (setq msgdb-path (elmo-folder-msgdb-path folder)) (unless (file-directory-p msgdb-path) @@ -123,7 +128,7 @@ (elmo-uniq-list (append (mapcar 'intern (delete ".." (delete "." (directory-files dir)))) - elmo-global-flag-list))))) + elmo-global-flags))))) (defun elmo-flag-folder-delete-message (folder number &optional keep-referrer) @@ -212,7 +217,7 @@ (defmacro elmo-flag-get-folder (flag) "Get the flag folder structure for FLAG." - `(when (memq ,flag elmo-global-flag-list) + `(when (memq ,flag elmo-global-flags) (elmo-make-folder (concat "'flag/" (symbol-name ,flag))))) (defun elmo-flag-folder-referrer (folder number) @@ -229,13 +234,13 @@ NUMBER is the number of the message." ;;; Global-Flag API (defun elmo-global-flag-p (flag) "Return non-nil when FLAG is global." - (memq flag elmo-global-flag-list)) + (memq flag elmo-global-flags)) (defun elmo-global-flags (fname number) "Return a list of global flags for the message. FNAME is the name string of the folder. NUMBER is the number of the message." - (let ((flag-list elmo-global-flag-list) + (let ((flag-list elmo-global-flags) folder matches) (while flag-list (setq folder (elmo-flag-get-folder (car flag-list))) @@ -271,7 +276,13 @@ NUMBER is the message number." (dolist (flag flags) (elmo-global-flag-set flag folder number message-id))) +(defun elmo-local-flag-p (flag) + "Return non-nil when flag is not appropriate for global flag." + (memq flag elmo-local-flags)) + (defsubst elmo-global-flag-set-internal (flag folder number message-id) + (when (elmo-local-flag-p flag) + (error "Cannot treat `%s' as global flag." flag)) (when message-id (let ((flag-folder (elmo-flag-get-folder flag)) cache new-file new-number elem) @@ -391,7 +402,7 @@ NUMBERS is the message number list. If optional DELETE-IF-NONE is non-nil, delete message from flag folder when the message is not flagged in any folder." (unless (eq (elmo-folder-type-internal folder) 'flag) - (dolist (flag elmo-global-flag-list) + (dolist (flag elmo-global-flags) (dolist (number numbers) (elmo-global-flag-detach flag folder number delete-if-none))))) @@ -402,7 +413,7 @@ If FLAGS is `t', all global flags becomes candidates. If optional IGNORE-PRESERVED is non-nil, preserved flags \(answered, cached, new, unread\) are not included." (let ((result (copy-sequence (if (eq flags t) - (setq flags elmo-global-flag-list) + (setq flags elmo-global-flags) flags)))) (while flags (unless (elmo-global-flag-p (car flags)) @@ -448,7 +459,7 @@ If optional IGNORE-PRESERVED is non-nil, preserved flags (luna-define-method elmo-folder-delete :around ((folder elmo-flag-folder)) (let ((flag (elmo-flag-folder-flag-internal folder))) (when (luna-call-next-method) - (setq elmo-global-flag-list (delq flag elmo-global-flag-list)) + (setq elmo-global-flags (delq flag elmo-global-flags)) t))) (require 'product) diff --git a/elmo/elmo-mime.el b/elmo/elmo-mime.el index 9b49f53..63084e2 100644 --- a/elmo/elmo-mime.el +++ b/elmo/elmo-mime.el @@ -44,6 +44,7 @@ (defvar elmo-message-ignored-field-list mime-view-ignored-field-list) (defvar elmo-message-visible-field-list mime-view-visible-field-list) (defvar elmo-message-sorted-field-list nil) +(defvar elmo-mime-display-header-analysis t) (defcustom elmo-mime-header-max-column fill-column "*Header max column number. Default is `fill-colmn'. @@ -87,8 +88,11 @@ value is used." (setq field (intern (capitalize (buffer-substring f-b (1- p)))) field-body (buffer-substring p f-e) - field-decoder (inline (mime-find-field-decoder-internal - field mode-obj))) + field-decoder + (if elmo-mime-display-header-analysis + (inline (mime-find-field-decoder-internal + field mode-obj)) + (inline (lambda (x y z) x)))) (setq vf-alist (append (list (cons field-name (list field-body field-decoder))) diff --git a/elmo/elmo-vars.el b/elmo/elmo-vars.el index f6dd981..88d36b4 100644 --- a/elmo/elmo-vars.el +++ b/elmo/elmo-vars.el @@ -63,7 +63,11 @@ :group 'elmo) (defcustom elmo-preserved-flags '(forwarded answered cached new unread) - "Reserved flags which are not treated as global." + "A list to define preserved flags. +Flags in this list can be searched by `any' flag condition. +If you want to treat a flag in this list as a `digest' flag, +you have to add it to `elmo-digest-flags'. +" :type '(repeat (symbol :tag "flag")) :group 'elmo) diff --git a/elmo/elmo.el b/elmo/elmo.el index 2d7c04a..47d6a07 100644 --- a/elmo/elmo.el +++ b/elmo/elmo.el @@ -85,6 +85,7 @@ Otherwise, entire fetching of the message is aborted without confirmation." (autoload 'elmo-dop-queue-flush "elmo-dop") (autoload 'elmo-nntp-post "elmo-nntp") (autoload 'elmo-global-flag-p "elmo-flag") + (autoload 'elmo-local-flag-p "elmo-flag") (autoload 'elmo-global-flag-detach "elmo-flag") (autoload 'elmo-global-flag-detach-messages "elmo-flag") (autoload 'elmo-global-flag-set "elmo-flag") @@ -1714,6 +1715,8 @@ Return a hashtable for newsgroups." 'elmo-cache-directory) (elmo-define-obsolete-variable 'elmo-msgdb-dir 'elmo-msgdb-directory) +(elmo-define-obsolete-variable 'elmo-global-flag-list + 'elmo-global-flags) ;; Obsolete functions. ;; 2001-12-11: *-dir -> *-directory diff --git a/wl/ChangeLog b/wl/ChangeLog index d627ed3..053f8ef 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,3 +1,39 @@ +2004-10-10 Yuuichi Teranishi + + * wl-vars.el (wl-summary-mode-line-format-spec-alist): Changed + definition for `m'. + (wl-summary-mode-line-format): Add '[%m]'. + (wl-message-mode-line-format-spec-alist): Ditto. + (wl-summary-display-mime-mode-list): New variable. + + * wl-summary.el (wl-summary-buffer-display-mime-mode): Renamed + from wl-summary-buffer-display-as-is. + (wl-summary-buffer-display-all-header): New buffer local variable. + (wl-summary-mode-map): Bind "H" to the 'wl-summary-toggle-all-header'. + (wl-summary-goto-folder-subr): Setup wl-summary-buffer-display-mime-mode + instead of wl-summary-buffer-display-as-is. + (wl-summary-unset-persistent-mark): Don't use term 'Flag' here. + (wl-summary-set-persistent-mark): Ditto. + (wl-summary-set-message-buffer-or-redisplay): Just call + `wl-summary-redisplay-internal' without optional arguments. + (wl-summary-toggle-mime): Rewrite. + (wl-summary-redisplay): Don't use `wl-summary-buffer-display-as-is'. + (wl-summary-toggle-all-header): New function. + (wl-summary-redisplay-internal): Treat mime mode. + + * wl-mime.el (wl-draft-yank-current-message-entity): Pass mode + to wl-mime-preview-follow-no-mime. + (wl-mime-preview-follow-no-mime): Bind elmo-mime-display-header-analysis + accodring to the display-mode. + + * wl-message.el (wl-message-buffer-display-type): Rewrite. + (wl-message-buffer-display): Changed argument name from `as-is' to + `mode'. + (wl-message-display-internal): Ditto; + Bind elmo-mime-display-header-analysis according to the mode. + (wl-message-display-internal): Put wl-message-display-mime-mode + property on entire buffer. + 2004-10-03 Yuuichi Teranishi * wl-draft.el (wl-draft-do-fcc): Undo last change. diff --git a/wl/wl-message.el b/wl/wl-message.el index b4a1cfe..d76d549 100644 --- a/wl/wl-message.el +++ b/wl/wl-message.el @@ -499,16 +499,13 @@ Returns non-nil if bottom of message." (select-window summary-win)) cache-used)) -(defun wl-message-buffer-display-type (as-is all-header) - (let ((type "")) - (if as-is - (setq type (concat type "as-is")) - (setq type (concat type "mime"))) +(defun wl-message-buffer-display-type (mode all-header) + (let ((type (symbol-name mode))) (when all-header (setq type (concat type "-all-header"))) (intern type))) ;; Use message buffer cache. -(defun wl-message-buffer-display (folder number as-is all-header +(defun wl-message-buffer-display (folder number mode all-header &optional force-reload unread) (let* ((msg-id (ignore-errors (elmo-message-field folder number 'message-id))) @@ -532,7 +529,7 @@ Returns non-nil if bottom of message." (goto-char (point-min)) (ignore-errors (wl-message-narrow-to-page)) (unless (eq wl-message-buffer-cur-display-type - (wl-message-buffer-display-type as-is all-header)) + (wl-message-buffer-display-type mode all-header)) (setq read t)))) ;; delete tail and add new to the top. (setq hit (wl-message-buffer-cache-add (list fname number msg-id))) @@ -543,10 +540,10 @@ Returns non-nil if bottom of message." (set-buffer hit) (setq cache-used - (wl-message-display-internal folder number as-is all-header + (wl-message-display-internal folder number mode all-header force-reload unread)) (setq wl-message-buffer-cur-display-type - (wl-message-buffer-display-type as-is all-header))) + (wl-message-buffer-display-type mode all-header))) (quit (wl-message-buffer-cache-delete) (error "Display message %s/%s is quitted" fname number)) @@ -556,14 +553,17 @@ Returns non-nil if bottom of message." nil))) ;; will not be used (cons hit cache-used))) -(defun wl-message-display-internal (folder number as-is all-header +(defun wl-message-display-internal (folder number mode all-header &optional force-reload unread) (let ((default-mime-charset wl-mime-charset) (elmo-mime-charset wl-mime-charset)) (setq wl-message-buffer-require-all-header all-header) (prog1 - (if as-is - (let (wl-highlight-x-face-function) + (if (or (eq mode 'as-is) + (eq mode 'header-only)) + (let ((elmo-mime-display-header-analysis (eq mode 'header-only)) + (wl-highlight-x-face-function + (unless (eq mode 'as-is) wl-highlight-x-face-function))) (prog1 (elmo-mime-display-as-is folder number (current-buffer) (wl-message-get-original-buffer) @@ -580,6 +580,9 @@ Returns non-nil if bottom of message." force-reload unread (wl-message-define-keymap))) + (let (buffer-read-only) + (put-text-property (point-min) (point-max) + 'wl-message-display-mime-mode mode)) (run-hooks 'wl-message-display-internal-hook) (setq buffer-read-only t)))) diff --git a/wl/wl-mime.el b/wl/wl-mime.el index 5897748..cde15e6 100644 --- a/wl/wl-mime.el +++ b/wl/wl-mime.el @@ -69,27 +69,32 @@ has Non-nil value\)" (cond ((wl-region-exists-p) (wl-mime-preview-follow-current-region)) - ((get-text-property (point-min) 'mime-view-entity) - (mime-preview-follow-current-entity)) + ((not (eq (get-text-property (point-min) + 'wl-message-display-mime-mode) + 'mime)) + (wl-mime-preview-follow-no-mime + (get-text-property (point-min) + 'wl-message-display-mime-mode))) (t - (wl-mime-preview-follow-no-mime))))) + (mime-preview-follow-current-entity))))) (error "No message.")))) ;; modified mime-preview-follow-current-entity from mime-view.el -(defun wl-mime-preview-follow-no-mime () +(defun wl-mime-preview-follow-no-mime (display-mode) "Write follow message to current message, without mime. It calls following-method selected from variable `mime-preview-following-method-alist'." (interactive) (let* ((mode (mime-preview-original-major-mode 'recursive)) (new-name (format "%s-no-mime" (buffer-name))) - new-buf beg end + new-buf min beg end (entity (get-text-property (point-min) 'elmo-as-is-entity)) (the-buf (current-buffer)) fields) (save-excursion (goto-char (point-min)) - (setq beg (re-search-forward "^$" nil t) + (setq min (point-min) + beg (re-search-forward "^$" nil t) end (point-max))) (save-excursion (set-buffer (setq new-buf (get-buffer-create new-name))) @@ -97,7 +102,8 @@ It calls following-method selected from variable (insert-buffer-substring the-buf beg end) (goto-char (point-min)) ;; Insert all headers. - (mime-insert-header entity) + (let ((elmo-mime-display-header-analysis (not (eq display-mode 'as-is)))) + (elmo-mime-insert-sorted-header entity)) (let ((f (cdr (assq mode mime-preview-following-method-alist)))) (if (functionp f) (funcall f new-buf) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index bea2754..0ca01fd 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -60,7 +60,7 @@ (defvar dragdrop-drop-functions) (defvar scrollbar-height) (defvar mail-reply-buffer) -(defvar elmo-global-flag-list) +(defvar elmo-global-flags) (defvar wl-summary-buffer-name "Summary") (defvar wl-summary-mode-map nil) @@ -109,7 +109,8 @@ (defvar wl-summary-buffer-line-format nil) (defvar wl-summary-buffer-mode-line-formatter nil) (defvar wl-summary-buffer-mode-line nil) -(defvar wl-summary-buffer-display-as-is nil) +(defvar wl-summary-buffer-display-mime-mode 'mime) +(defvar wl-summary-buffer-display-all-header nil) (defvar wl-thread-indent-level-internal nil) (defvar wl-thread-have-younger-brother-str-internal nil) @@ -183,7 +184,8 @@ (make-variable-buffer-local 'wl-summary-buffer-line-format) (make-variable-buffer-local 'wl-summary-buffer-mode-line-formatter) (make-variable-buffer-local 'wl-summary-buffer-mode-line) -(make-variable-buffer-local 'wl-summary-buffer-display-as-is) +(make-variable-buffer-local 'wl-summary-buffer-display-mime-mode) +(make-variable-buffer-local 'wl-summary-buffer-display-all-header) (defvar wl-datevec) (defvar wl-thr-indent-string) @@ -435,7 +437,7 @@ See also variable `wl-use-petname'." (define-key wl-summary-mode-map "\C-c\C-a" 'wl-addrmgr) (define-key wl-summary-mode-map "\C-c\C-p" 'wl-summary-previous-buffer) (define-key wl-summary-mode-map "\C-c\C-n" 'wl-summary-next-buffer) - (define-key wl-summary-mode-map "H" 'wl-summary-redisplay-all-header) + (define-key wl-summary-mode-map "H" 'wl-summary-toggle-all-header) (define-key wl-summary-mode-map "M" 'wl-summary-toggle-mime) (define-key wl-summary-mode-map "B" 'wl-summary-burst) (define-key wl-summary-mode-map "Z" 'wl-status-update) @@ -1794,7 +1796,7 @@ This function is defined for `window-scroll-functions'" (defun wl-summary-get-available-flags (&optional include-specials) (let ((flags (elmo-uniq-list - (append elmo-global-flag-list + (append elmo-global-flags (copy-sequence elmo-preserved-flags)) #'delq))) (if include-specials @@ -2299,8 +2301,10 @@ If ARG, without confirm." (unless (eq major-mode 'wl-summary-mode) (wl-summary-mode)) (wl-summary-buffer-set-folder folder) - (setq wl-summary-buffer-display-as-is - (wl-summary-no-mime-p wl-summary-buffer-elmo-folder)) + (setq wl-summary-buffer-display-mime-mode + (if (wl-summary-no-mime-p wl-summary-buffer-elmo-folder) + 'as-is + 'mime)) (setq wl-summary-buffer-disp-msg nil) (setq wl-summary-buffer-last-displayed-msg nil) (setq wl-summary-buffer-current-msg nil) @@ -3119,7 +3123,7 @@ Return non-nil if the mark is updated" (let ((completion-ignore-case t)) (setq flag (intern (downcase (completing-read - "Flag: " + "Mark name: " (mapcar (lambda (flag) (list (capitalize (symbol-name flag)))) (wl-summary-get-available-flags)) @@ -3142,7 +3146,7 @@ Return non-nil if the mark is updated" (let ((completion-ignore-case t)) (setq flag (intern (downcase (completing-read - "Flag: " + "Mark name: " (mapcar (lambda (flag) (list (capitalize (symbol-name flag)))) (wl-summary-get-available-flags)) @@ -3162,7 +3166,7 @@ Return non-nil if the mark is updated" flag) (setq flag (intern (downcase (completing-read - "Flag: " + "Mark name: " (mapcar (lambda (flag) (list (capitalize (symbol-name flag)))) (wl-summary-get-available-flags)) @@ -3212,18 +3216,20 @@ Return non-nil if the mark is updated" "Flags: " (mapcar (lambda (flag) (list (capitalize (symbol-name flag)))) - elmo-global-flag-list) + elmo-global-flags) nil nil (mapconcat (lambda (flag) (capitalize (symbol-name flag))) flags ","))))) (dolist (flag new-flags) - (unless (memq flag elmo-global-flag-list) - (if (y-or-n-p (format "Flag `%s' does not exist yet. Create?" + (unless (memq flag elmo-global-flags) + (when (elmo-local-flag-p flag) + (error "Cannot treat `%s'." flag)) + (if (y-or-n-p (format "Flag `%s' is not registered yet. Register?" (capitalize (symbol-name flag)))) - (setq elmo-global-flag-list (append - elmo-global-flag-list - (list flag))) + (setq elmo-global-flags (append + elmo-global-flags + (list flag))) (error "Stopped")))) new-flags)) @@ -3821,8 +3827,7 @@ Return t if message exists." (progn (set-buffer wl-message-buffer) t) - (wl-summary-redisplay-internal folder number nil - wl-summary-buffer-display-as-is) + (wl-summary-redisplay-internal folder number) (when (buffer-live-p wl-message-buffer) (set-buffer wl-message-buffer)) nil))) @@ -4355,46 +4360,69 @@ Use function list is `wl-summary-write-current-folder-functions'." (wl-summary-redisplay))) (message "No last message."))) -(defun wl-summary-toggle-mime (&optional no-mime) +(defun wl-summary-toggle-mime (&optional arg) "Toggle MIME decoding. -If NO-MIME is non-nil, force displaying the message without MIME decoding -and ask coding-system for the message." +If ARG is non-nil, ask coding-system to display the message in the current +MIME analysis mode. + +If ARG is numeric number, decode message as following: +1: Enable MIME analysis. +2: Enable MIME analysis only for headers. +3: Disable MIME analysis." (interactive "P") - (if no-mime - (wl-summary-redisplay-no-mime 'ask-coding) - (setq wl-summary-buffer-display-as-is - (not wl-summary-buffer-display-as-is)) - (wl-summary-redisplay) + (let ((rest (memq wl-summary-buffer-display-mime-mode + wl-summary-display-mime-mode-list)) + (elmo-mime-display-as-is-coding-system + elmo-mime-display-as-is-coding-system)) + (if (numberp arg) + (setq wl-summary-buffer-display-mime-mode + (case arg + (1 'mime) + (2 'header-only) + (3 'as-is))) + (if arg + ;; Specify coding-system (doesn't change the MIME mode). + (setq elmo-mime-display-as-is-coding-system + (if (and arg (not (eq wl-summary-buffer-display-mime-mode + 'mime))) + (or (read-coding-system "Coding system: ") + elmo-mime-display-as-is-coding-system) + elmo-mime-display-as-is-coding-system)) + ;; Change the MIME mode. + (if (cadr rest) + (setq wl-summary-buffer-display-mime-mode (cadr rest)) + (setq wl-summary-buffer-display-mime-mode + (car wl-summary-display-mime-mode-list))))) + (wl-summary-redisplay arg) (wl-summary-update-modeline) - (message "MIME decoding: %s" - (if wl-summary-buffer-display-as-is "OFF" "ON")))) + (message "MIME decoding: %s%s" + (upcase (symbol-name wl-summary-buffer-display-mime-mode)) + (if (and arg + (not (numberp arg)) + (not (eq wl-summary-buffer-display-mime-mode + 'mime))) + (concat " (" + (symbol-name elmo-mime-display-as-is-coding-system) + ")") + "")))) (defun wl-summary-redisplay (&optional arg) "Redisplay message." (interactive "P") - (wl-summary-redisplay-internal nil nil arg - wl-summary-buffer-display-as-is)) - -(defun wl-summary-redisplay-all-header (&optional arg) - "Redisplay message with all header." - (interactive "P") - (wl-summary-redisplay-internal nil nil arg - wl-summary-buffer-display-as-is 'all-header)) + (wl-summary-redisplay-internal nil nil arg)) -(defun wl-summary-redisplay-no-mime (&optional ask-coding) - "Display message without MIME decoding. -If ASK-CODING is non-nil, coding-system for the message is asked." +(defun wl-summary-toggle-all-header (&optional arg) + "Toggle displaying message with all header." (interactive "P") - (let ((elmo-mime-display-as-is-coding-system - (if ask-coding - (or (read-coding-system "Coding system: ") - elmo-mime-display-as-is-coding-system) - elmo-mime-display-as-is-coding-system))) - (wl-summary-redisplay-internal nil nil nil 'as-is 'all-header))) + (setq wl-summary-buffer-display-all-header + (not wl-summary-buffer-display-all-header)) + (wl-summary-redisplay-internal nil nil arg)) (defun wl-summary-redisplay-internal (&optional folder number force-reload - as-is all-header) + mode all-header) (let* ((folder (or folder wl-summary-buffer-elmo-folder)) + (mode (or mode wl-summary-buffer-display-mime-mode)) + (all-header (or all-header wl-summary-buffer-display-all-header)) (num (or number (wl-summary-message-number))) (wl-mime-charset wl-summary-buffer-mime-charset) (default-mime-charset wl-summary-buffer-mime-charset) @@ -4423,7 +4451,7 @@ If ASK-CODING is non-nil, coding-system for the message is asked." (setq no-folder-mark ;; If cache is used, change folder-mark. (if (wl-message-redisplay folder num - as-is all-header + mode all-header (or force-reload (string= (elmo-folder-name-internal @@ -4670,7 +4698,6 @@ If ASK-CODING is non-nil, coding-system for the message is asked." wl-break-pages) (save-excursion (wl-summary-set-message-buffer-or-redisplay) - ;; (wl-summary-redisplay-internal) (let* ((buffer (generate-new-buffer " *print*")) (entity (progn (set-buffer summary-buffer) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 5484c81..7fc69a9 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -201,7 +201,7 @@ If no match, `wl-summary-default-view' is used." wl-summary-buffer-elmo-folder)) (elmo-folder-name-internal wl-summary-buffer-elmo-folder))) (?t (if (eq wl-summary-buffer-view 'thread) "T" "S")) - (?m (if wl-summary-buffer-display-as-is "-" "M")) + (?m (upcase (symbol-name wl-summary-buffer-display-mime-mode))) (?n wl-summary-buffer-new-count) (?u wl-summary-buffer-unread-count) (?a (length wl-summary-buffer-number-list))) @@ -211,7 +211,7 @@ Each element is a list of following: SPEC is a character for format specification. STRING-EXP is an expression to get string to insert.") -(defcustom wl-summary-mode-line-format "Wanderlust: %f {%t}(%n/%u/%a)" +(defcustom wl-summary-mode-line-format "Wanderlust: %f {%t}(%n/%u/%a)[%m]" "*A format string for summary mode-line of Wanderlust. It may include any of the following format specifications which are replaced by the given information: @@ -1104,6 +1104,17 @@ Example: :type '(repeat string) :group 'wl-summary) +(defcustom wl-summary-display-mime-mode-list '(mime as-is) + "*Display mime mode list toggled by `wl-summary-toggle-mime'. +Candidates are following: +`mime' ... header and body are decoded +`header-only' ... only header is decoded +`as-is' ... header and body are not decoded" + :type '(repeat (choice (const :tag "MIME" mime) + (const :tag "HEADER-ONLY" header-only) + (const :tag "AS-IS" as-is))) + :group 'wl-summary) + (defcustom wl-summary-fix-timezone nil "*Time zone of the date string in summary mode. If nil, it is adjust to the default time zone information @@ -1645,8 +1656,9 @@ which appear just before @." '((?f (if (memq 'modeline wl-use-folder-petname) (wl-folder-get-petname wl-message-buffer-cur-folder) wl-message-buffer-cur-folder)) - (?m (if (get-text-property (point-min) 'mime-view-entity) - "MIME" "AS-IS")) + (?m (upcase (symbol-name + (get-text-property (point-min) + 'wl-message-display-mime-mode)))) (?F wl-message-buffer-flag-indicator) (?n wl-message-buffer-cur-number)) "An alist of format specifications for message buffer's mode-lines.