X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Fmm-decode.el;h=49fc7e1f3d063980bcec1bbc10d455a491403fe3;hb=66c26c155163db358a8641e5165b0439f95e7133;hp=0fcc1be775b5c14bb11d1604ca976d1df2bc6786;hpb=04ba5250e9e47ebe40860a0902d4ef6405ca143f;p=elisp%2Fgnus.git- diff --git a/lisp/mm-decode.el b/lisp/mm-decode.el index 0fcc1be..49fc7e1 100644 --- a/lisp/mm-decode.el +++ b/lisp/mm-decode.el @@ -32,7 +32,6 @@ (require 'term)) (eval-and-compile - (autoload 'executable-find "executable") (autoload 'mm-inline-partial "mm-partial") (autoload 'mm-inline-external-body "mm-extern") (autoload 'mm-insert-inline "mm-view")) @@ -41,7 +40,7 @@ (defgroup mime-display () "Display of MIME in mail and news articles." - :link '(custom-manual "(emacs-mime)Customization") + :link '(custom-manual "(emacs-mime)Display Customization") :version "21.1" :group 'mail :group 'news @@ -49,7 +48,7 @@ (defgroup mime-security () "MIME security in mail and news articles." - :link '(custom-manual "(emacs-mime)Customization") + :link '(custom-manual "(emacs-mime)Display Customization") :group 'mail :group 'news :group 'multimedia) @@ -99,8 +98,9 @@ (defcustom mm-text-html-renderer (cond ((locate-library "w3") 'w3) - ((locate-library "w3m") 'w3m) - ((executable-find "w3m") 'w3m-standalone) + ((executable-find "w3m") (if (locate-library "w3m") + 'w3m + 'w3m-standalone)) ((executable-find "links") 'links) ((executable-find "lynx") 'lynx) (t 'html2text)) @@ -114,6 +114,7 @@ The defined renderer types are: `lynx' : use lynx; `html2text' : use html2text; nil : use external viewer." + :version "21.4" :type '(choice (const w3) (const w3m) (const w3m-standalone) @@ -122,7 +123,6 @@ nil : use external viewer." (const html2text) (const nil) (function)) - :version "21.3" :group 'mime-display) (defvar mm-inline-text-html-renderer nil @@ -133,6 +133,7 @@ It is suggested to customize `mm-text-html-renderer' instead.") "If non-nil, Gnus will allow retrieving images in HTML contents with the tags. It has no effect on Emacs/w3. See also the documentation for the `mm-w3m-safe-url-regexp' variable." + :version "21.4" :type 'boolean :group 'mime-display) @@ -218,6 +219,7 @@ before the external MIME handler is invoked." (locate-library "diff-mode"))) ("application/emacs-lisp" mm-display-elisp-inline identity) ("application/x-emacs-lisp" mm-display-elisp-inline identity) + ("text/dns" mm-display-dns-inline identity) ("text/html" mm-inline-text-html (lambda (handle) @@ -279,13 +281,14 @@ type inline." "application/pdf" "application/x-dvi") "List of media types for which the external viewer will not be killed when selecting a different article." + :version "21.4" :type '(repeat string) :group 'mime-display) (defcustom mm-automatic-display '("text/plain" "text/enriched" "text/richtext" "text/html" "text/x-vcard" "image/.*" "message/delivery-status" "multipart/.*" - "message/rfc822" "text/x-patch" "application/pgp-signature" + "message/rfc822" "text/x-patch" "text/dns" "application/pgp-signature" "application/emacs-lisp" "application/x-emacs-lisp" "application/x-pkcs7-signature" "application/pkcs7-signature" "application/x-pkcs7-mime" @@ -380,6 +383,7 @@ If not set, `default-directory' will be used." (defcustom mm-external-terminal-program "xterm" "The program to start an external terminal." + :version "21.4" :type 'string :group 'mime-display) @@ -412,6 +416,7 @@ If not set, `default-directory' will be used." "Option of verifying signed parts. `never', not verify; `always', always verify; `known', only verify known protocols. Otherwise, ask user." + :version "21.4" :type '(choice (item always) (item never) (item :tag "only known protocols" known) @@ -522,15 +527,11 @@ Postpone undisplaying of viewers for types in ;; solution, avoids most of them. (if from (setq from (cadr (mail-extract-address-components from)))))) - (when cte - (setq cte (mail-header-strip cte))) (if (or (not ctl) (not (string-match "/" (car ctl)))) (mm-dissect-singlepart (list mm-dissect-default-type) - (and cte (intern (downcase (mail-header-remove-whitespace - (mail-header-remove-comments - cte))))) + (and cte (intern (downcase (mail-header-strip cte)))) no-strict-mime (and cd (ignore-errors (mail-header-parse-content-disposition cd))) description) @@ -563,9 +564,7 @@ Postpone undisplaying of viewers for types in (mm-possibly-verify-or-decrypt (mm-dissect-singlepart ctl - (and cte (intern (downcase (mail-header-remove-whitespace - (mail-header-remove-comments - cte))))) + (and cte (intern (downcase (mail-header-strip cte)))) no-strict-mime (and cd (ignore-errors (mail-header-parse-content-disposition cd))) @@ -617,18 +616,17 @@ Postpone undisplaying of viewers for types in (defun mm-copy-to-buffer () "Copy the contents of the current buffer to a fresh buffer." (save-excursion - (let ((flag enable-multibyte-characters) - (new-buffer (generate-new-buffer " *mm*"))) + (let ((obuf (current-buffer)) + beg) (goto-char (point-min)) (search-forward-regexp "^\n" nil t) - (save-restriction - (narrow-to-region (point) (point-max)) - (when flag - (set-buffer-multibyte nil)) - (copy-to-buffer new-buffer (point-min) (point-max)) - (when flag - (set-buffer-multibyte t))) - new-buffer))) + (setq beg (point)) + (set-buffer + ;; Preserve the data's unibyteness (for url-insert-file-contents). + (let ((default-enable-multibyte-characters (mm-multibyte-p))) + (generate-new-buffer " *mm*"))) + (insert-buffer-substring obuf beg) + (current-buffer)))) (defun mm-display-parts (handle &optional no-default) (if (stringp (car handle)) @@ -837,16 +835,16 @@ external if displayed external." (string= total "'%s'") (string= total "\"%s\"")) (setq uses-stdin nil) - (push (mm-quote-arg + (push (shell-quote-argument (gnus-map-function mm-path-name-rewrite-functions file)) out)) ((string= total "%t") - (push (mm-quote-arg (car type-list)) out)) + (push (shell-quote-argument (car type-list)) out)) (t - (push (mm-quote-arg (or (cdr (assq (intern sub) ctl)) "")) out)))) + (push (shell-quote-argument (or (cdr (assq (intern sub) ctl)) "")) out)))) (push (substring method beg (length method)) out) (when uses-stdin (push "<" out) - (push (mm-quote-arg + (push (shell-quote-argument (gnus-map-function mm-path-name-rewrite-functions file)) out)) (mapconcat 'identity (nreverse out) ""))) @@ -1094,9 +1092,10 @@ string if you do not like underscores." (setq filename (gnus-map-function mm-file-name-rewrite-functions (file-name-nondirectory filename)))) (setq file - (read-file-name "Save MIME part to: " - (or mm-default-directory default-directory) - nil nil (or filename name ""))) + (mm-with-multibyte + (read-file-name "Save MIME part to: " + (or mm-default-directory default-directory) + nil nil (or filename name "")))) (setq mm-default-directory (file-name-directory file)) (and (or (not (file-exists-p file)) (yes-or-no-p (format "File %s already exists; overwrite? " @@ -1455,6 +1454,12 @@ If RECURSIVE, search recursively." parts)) (defun mm-multiple-handles (handles) + (and (listp handles) + (> (length handles) 1) + (or (listp (car handles)) + (stringp (car handles))))) + +(defun mm-complicated-handles (handles) (and (listp (car handles)) (> (length handles) 1)))