;;; mm-decode.el --- Functions for decoding MIME things
-;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004
+;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
;; Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
`lynx' : use lynx;
`html2text' : use html2text;
nil : use external viewer."
- :version "21.4"
+ :version "22.1"
:type '(choice (const w3)
(const w3m)
(const w3m-standalone)
"If non-nil, Gnus will allow retrieving images in HTML contents with
the <img> tags. It has no effect on Emacs/w3. See also the
documentation for the `mm-w3m-safe-url-regexp' variable."
- :version "21.4"
+ :version "22.1"
:type 'boolean
:group 'mime-display)
matches parts embedded to the Multipart/Related type MIME contents and
Gnus will never connect to the spammer's site arbitrarily. You may
set this variable to nil if you consider all urls to be safe."
+ :version "22.1"
:type '(choice (regexp :tag "Regexp")
(const :tag "All URLs are safe" nil))
:group 'mime-display)
(defcustom mm-inline-text-html-with-w3m-keymap t
"If non-nil, use emacs-w3m command keys in the article buffer."
+ :version "22.1"
:type 'boolean
:group 'mime-display)
If t, all defined external MIME handlers are used. If nil, files are saved by
`mailcap-save-binary-file'. If it is the symbol `ask', you are prompted
before the external MIME handler is invoked."
- :version "21.4"
+ :version "22.1"
:type '(choice (const :tag "Always" t)
(const :tag "Never" nil)
(const :tag "Ask" ask))
"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"
+ :version "22.1"
:type '(repeat string)
:group 'mime-display)
(defcustom mm-attachment-file-modes 384
"Set the mode bits of saved attachments to this integer."
+ :version "22.1"
:type 'integer
:group 'mime-display)
(defcustom mm-external-terminal-program "xterm"
"The program to start an external terminal."
- :version "21.4"
+ :version "22.1"
:type 'string
:group 'mime-display)
"Option of verifying signed parts.
`never', not verify; `always', always verify;
`known', only verify known protocols. Otherwise, ask user."
- :version "21.4"
+ :version "22.1"
:type '(choice (item always)
(item never)
(item :tag "only known protocols" known)
"Option of decrypting encrypted parts.
`never', not decrypt; `always', always decrypt;
`known', only decrypt known protocols. Otherwise, ask user."
+ :version "22.1"
:type '(choice (item always)
(item never)
(item :tag "only known protocols" known)
(defun mm-dissect-singlepart (ctl cte &optional force cdl description id)
(when (or force
(if (equal "text/plain" (car ctl))
- ;; FIXME: This is a kludge. Proper fix is to make
- ;; gnus-display-mime invoke mm-uu-dissect on all
- ;; textual MIME parts, and stop using mm-fill-flowed
- ;; here.
- (and mm-fill-flowed (assoc 'format ctl))
+ (assoc 'format ctl)
t))
(mm-make-handle
(mm-copy-to-buffer) ctl cte nil cdl description nil id)))
(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))
(defun mm-insert-part (handle)
"Insert the contents of HANDLE in the current buffer."
- (let ((cur (current-buffer)))
- (save-excursion
- (if (member (mm-handle-media-supertype handle) '("text" "message"))
- (with-temp-buffer
- (insert-buffer-substring (mm-handle-buffer handle))
- (prog1
- (mm-decode-content-transfer-encoding
- (mm-handle-encoding handle)
- (mm-handle-media-type handle))
- (let ((temp (current-buffer)))
- (set-buffer cur)
- (insert-buffer-substring temp))))
- (mm-with-unibyte-buffer
- (insert-buffer-substring (mm-handle-buffer handle))
- (prog1
- (mm-decode-content-transfer-encoding
- (mm-handle-encoding handle)
- (mm-handle-media-type handle))
- (let ((temp (current-buffer)))
- (set-buffer cur)
- (insert-buffer-substring temp))))))))
+ (save-excursion
+ (insert (if (mm-multibyte-p)
+ (mm-string-as-multibyte (mm-get-part handle))
+ (mm-get-part handle)))))
(defun mm-file-name-delete-whitespace (file-name)
"Remove all whitespace characters from FILE-NAME."