Mercurial > emacs
comparison lisp/mh-e/mh-mime.el @ 66354:cf99ce27df54
* mh-comp.el (mh-letter-menu): Rename
mh-mhn-compose-external-compressed-tar to
mh-mh-compose-external-compressed-tar. Rename mh-mhn-compose-anon-ftp
to mh-mh-compose-anon-ftp. Rename mh-edit-mhn to mh-mh-to-mime. Rename
mh-mhn-directive-present-p to mh-mh-directive-present-p. Rename
mh-revert-mhn-edit to mh-mh-to-mime-undo. Rename
mh-gnus-pgp-support-flag to mh-pgp-support-flag. Rename
mh-compose-insertion value from 'mhn to 'mh.
(mh-insert-signature): Rename mh-mhn-directive-present-p to
mh-mh-directive-present-p.
(mh-send-letter): Rename mh-mhn-directive-present-p to
mh-mh-directive-present-p. Rename mh-edit-mhn to mh-mh-to-mime.
(mh-letter-mode-map): Rename mh-edit-mhn to mh-mh-to-mime. Rename
mh-mhn-compose-anon-ftp to mh-mh-compose-anon-ftp. Rename
mh-mhn-compose-external-compressed-tar to
mh-mh-compose-external-compressed-tar. Rename mh-revert-mhn-edit to
mh-mh-to-mime-undo. Rename mh-mhn-compose-external-type to
mh-mh-compose-external-type. Rename mh-mhn-compose-anon-ftp to
mh-mh-compose-anon-ftp. Rename mh-mhn-compose-external-compressed-tar
to mh-mh-compose-external-compressed-tar. Rename mh-revert-mhn-edit to
mh-mh-to-mime-undo. Rename mh-mhn-compose-external-type to
mh-mh-compose-external-type.
(mh-send-letter, mh-letter-mode-map): Rename mh-edit-mhn to
mh-mh-to-mime, mh-revert-mhn-edit to mh-mh-to-mime-undo.
(mh-reply, mh-yank-cur-msg, mh-insert-prefix-string): Rename
mh-yank-from-start-of-msg to mh-yank-behavior. (mh-letter-mode,
mh-to-field, mh-to-fcc, mh-insert-signature) (mh-check-whom,
mh-insert-auto-fields, mh-send-letter) (mh-insert-letter,
mh-yank-cur-msg, mh-insert-prefix-string) (mh-fully-kill-draft,
mh-open-line, mh-letter-complete) (mh-letter-complete-or-space,
mh-letter-confirm-address) (mh-letter-next-header-field-or-indent)
(mh-letter-previous-header-field)
(mh-letter-toggle-header-field-display): Sync docstrings with manual.
* mh-customize.el (mh-edit-mhn-hook): Rename to mh-mh-to-mime-hook.
(mh-yank-from-start-of-msg): Rename to mh-yank-behavior.
(mh-compose-insertion): Rename values from 'gnus and 'mhn to 'mh and
user-visible values from mhn and Gnus to MH and MML.
(mh-before-send-letter-hook): Added 'ispell-message option.
(mh-mml-method-default): Rename mh-gnus-pgp-support-flag to
mh-pgp-support-flag. (mh-compose-insertion,
mh-compose-space-does-completion-flag)
(mh-delete-yanked-msg-window-flag) (mh-extract-from-attribution-verb,
mh-ins-buf-prefix) (mh-letter-complete-function,
mh-letter-fill-column) (mh-mml-method-default, mh-signature-file-name)
(mh-signature-separator-flag, mh-x-face-file) (mh-yank-behavior,
mail-citation-hook)
(mh-before-send-letter-hook, mh-mh-to-mime-hook): Sync docstrings with
manual.
* mh-gnus.el (mml-minibuffer-read-disposition): New function provided
for Emacs 21 environments that lack it.
* mh-mime.el (mh-mml-query-cryptographic-method): Use default prompt
convention.
(mh-compose-forward): mh-mh-forward-message requires string arg.
(mh-minibuffer-read-type): New function.
(mh-mhn-args): Rename to mh-mh-to-mime-args.
(mh-mhn-compose-insertion): Rename to mh-mh-attach-file.
(mh-mhn-compose-forw): Rename to mh-mh-forward-message.
(mh-mhn-compose-type): Rename to mh-mh-compose-type.
(mh-mhn-compose-anon-ftp): Rename to mh-mh-compose-anon-ftp. Rename
mh-mhn-compose-external-type to mh-mh-compose-external-type.
(mh-mhn-compose-external-compressed-tar): Rename to
mh-mh-compose-external-compressed-tar. Rename
mh-mhn-compose-external-type to mh-mh-compose-external-type.
(mh-mhn-compose-external-type): Rename to mh-mh-compose-external-type.
(mh-edit-mhn): Rename to mh-mh-to-mime. Rename mh-mhn-args to
mh-mh-to-mime-args. Rename mh-edit-mhn-hook to mh-mh-to-mime-hook. Use
correct program in message.
(mh-mhn-directive-present-p): Rename to mh-mh-directive-present-p.
(mh-mml-directive-present-p): Rename to mh-mml-tag-present-p.
(mh-compose-forward, mh-mh-attach-file) (mh-mh-compose-anon-ftp,
mh-mh-compose-external-compressed-tar) (mh-mh-compose-external-type,
mh-mh-forward-message)
(mh-mml-attach-file): Use mml-minibuffer-read-description,
mh-minibuffer-read-type.
(mh-mime-content-types): Moved comment about only being used in Emacs
20 to docstring.
(mh-mh-compose-external-type): Rename extra-param argument to
parameters. (mh-mml-to-mime, mh-secure-message)
(mh-mml-unsecure-message, mh-mime-display-part)
(mh-mime-display-single): Rename mh-gnus-pgp-support-flag to
mh-pgp-support-flag.
(mh-compose-insertion): Rename mh-mhn-compose-insertion to
mh-mh-attach-file.
(mh-compose-forward): Rename mh-mhn-compose-forw to
mh-mh-forward-message.
(mh-mhn-compose-insertion): Rename mh-mhn-compose-type to
mh-mh-compose-type. (mh-compose-insertion, mh-compose-forward,
mh-mh-to-mime-args) (mh-mh-attach-file, mh-mh-compose-type)
(mh-mh-compose-anon-ftp, mh-mh-compose-external-compressed-tar)
(mh-mh-compose-external-compressed-tar) (mh-mh-compose-external-type,
mh-mh-forward-message) (mh-mh-to-mime, mh-mh-quote-unescaped-sharp,
(mh-mh-to-mime-undo, mh-mh-directive-present-p, mh-mml-to-mime)
(mh-mml-attach-file, mh-secure-message, mh-mml-unsecure-message)
(mh-mml-secure-message-sign, mh-mml-secure-message-encrypt)
(mh-mml-directive-present-p, mh-destroy-postponed-handles)
(mh-display-smileys, mh-display-emphasis, mh-mime-save-parts): Sync
docstrings with manual.
* mh-utils.el (mh-gnus-pgp-support-flag): Rename to
mh-pgp-support-flag.
author | Bill Wohler <wohler@newt.com> |
---|---|
date | Sun, 23 Oct 2005 21:26:17 +0000 |
parents | 88d998016498 |
children | 9f52d5da9ca6 |
comparison
equal
deleted
inserted
replaced
66353:e81cb0b6850a | 66354:cf99ce27df54 |
---|---|
26 ;; Boston, MA 02110-1301, USA. | 26 ;; Boston, MA 02110-1301, USA. |
27 | 27 |
28 ;;; Commentary: | 28 ;;; Commentary: |
29 | 29 |
30 ;; Internal support for MH-E package. | 30 ;; Internal support for MH-E package. |
31 ;; Support for generating an mhn composition file. | 31 ;; Support for generating MH-style directives for mhn or mhbuild as well as |
32 ;; MIME is supported only by MH 6.8 or later. | 32 ;; MML (MIME Meta Language) tags. MH-style directives are supported by MH 6.8 |
33 ;; or later. | |
33 | 34 |
34 ;;; Change Log: | 35 ;;; Change Log: |
35 | 36 |
36 ;;; Code: | 37 ;;; Code: |
37 | 38 |
39 (mh-require-cl) | 40 (mh-require-cl) |
40 (require 'mh-comp) | 41 (require 'mh-comp) |
41 (require 'gnus-util) | 42 (require 'gnus-util) |
42 (require 'mh-gnus) | 43 (require 'mh-gnus) |
43 | 44 |
45 (autoload 'article-emphasize "gnus-art") | |
44 (autoload 'gnus-article-goto-header "gnus-art") | 46 (autoload 'gnus-article-goto-header "gnus-art") |
45 (autoload 'article-emphasize "gnus-art") | 47 (autoload 'gnus-eval-format "gnus-spec") |
46 (autoload 'gnus-get-buffer-create "gnus") | 48 (autoload 'gnus-get-buffer-create "gnus") |
47 (autoload 'gnus-eval-format "gnus-spec") | 49 (autoload 'message-options-set-recipient "message") |
50 (autoload 'mml-attach-file "mml") | |
51 (autoload 'mml-insert-empty-tag "mml") | |
52 (autoload 'mml-minibuffer-read-description "mml") | |
53 (autoload 'mml-minibuffer-read-disposition "mml") | |
54 (autoload 'mml-minibuffer-read-file "mml") | |
55 (autoload 'mml-to-mime "mml") | |
56 (autoload 'mml-unsecure-message "mml-sec") | |
57 (autoload 'rfc2047-decode-region "rfc2047") | |
48 (autoload 'widget-convert-button "wid-edit") | 58 (autoload 'widget-convert-button "wid-edit") |
49 (autoload 'message-options-set-recipient "message") | |
50 (autoload 'mml-unsecure-message "mml-sec") | |
51 (autoload 'mml-minibuffer-read-file "mml") | |
52 (autoload 'mml-minibuffer-read-description "mml") | |
53 (autoload 'mml-insert-empty-tag "mml") | |
54 (autoload 'mml-to-mime "mml") | |
55 (autoload 'mml-attach-file "mml") | |
56 (autoload 'rfc2047-decode-region "rfc2047") | |
57 | 59 |
58 ;;;###mh-autoload | 60 ;;;###mh-autoload |
59 (defun mh-compose-insertion (&optional inline) | 61 (defun mh-compose-insertion (&optional inline) |
60 "Add a directive to insert a MIME part from a file, using mhn or gnus. | 62 "Add tag to include a file such as an image or sound. |
61 If the variable `mh-compose-insertion' is set to 'mhn, then that will be used. | 63 You are prompted for the filename containing the object, the media type if it |
62 If it is set to 'gnus, then that will be used instead. | 64 cannot be determined automatically, and a content description. If you're using |
65 MH-style directives, you will also be prompted for additional attributes. | |
66 | |
67 The option `mh-compose-insertion' controls what type of tags are inserted. | |
63 Optional argument INLINE means make it an inline attachment." | 68 Optional argument INLINE means make it an inline attachment." |
64 (interactive "P") | 69 (interactive "P") |
65 (if (equal mh-compose-insertion 'gnus) | 70 (if (equal mh-compose-insertion 'mml) |
66 (if inline | 71 (if inline |
67 (mh-mml-attach-file "inline") | 72 (mh-mml-attach-file "inline") |
68 (mh-mml-attach-file)) | 73 (mh-mml-attach-file)) |
69 (call-interactively 'mh-mhn-compose-insertion))) | 74 (call-interactively 'mh-mh-attach-file))) |
70 | 75 |
71 ;;;###mh-autoload | 76 ;;;###mh-autoload |
72 (defun mh-compose-forward (&optional description folder messages) | 77 (defun mh-compose-forward (&optional description folder messages) |
73 "Add a MIME directive to forward a message, using mhn or gnus. | 78 "Add tag to forward a message. |
74 If the variable `mh-compose-insertion' is set to 'mhn, then that will be used. | 79 You are prompted for a content DESCRIPTION, the name of the FOLDER in which |
75 If it is set to 'gnus, then that will be used instead. | 80 the messages to forward are located, and the MESSAGES' numbers. |
76 Optional argument DESCRIPTION is a description of the attachment. | 81 |
77 Optional argument FOLDER is the folder from which the forwarded message should | 82 The option `mh-compose-insertion' controls what type of tags are inserted." |
78 come. | |
79 Optional argument MESSAGES is the range of messages to forward. | |
80 If any of the optional arguments are absent, they are prompted for." | |
81 (interactive (let* | 83 (interactive (let* |
82 ((description (read-string "Forw Content-description: ")) | 84 ((description (mml-minibuffer-read-description)) |
83 (folder (mh-prompt-for-folder "Message from" | 85 (folder (mh-prompt-for-folder "Message from" |
84 mh-sent-from-folder nil)) | 86 mh-sent-from-folder nil)) |
85 (messages (let ((default-message | 87 (messages (let ((default-message |
86 (if (and (equal | 88 (if (and (equal |
87 folder mh-sent-from-folder) | 89 folder mh-sent-from-folder) |
103 (setq messages "")) | 105 (setq messages "")) |
104 (setq range (mh-translate-range folder messages)) | 106 (setq range (mh-translate-range folder messages)) |
105 (if (null range) | 107 (if (null range) |
106 (error "No messages in specified range")) | 108 (error "No messages in specified range")) |
107 (dolist (message range) | 109 (dolist (message range) |
108 (if (equal mh-compose-insertion 'gnus) | 110 (if (equal mh-compose-insertion 'mml) |
109 (mh-mml-forward-message description folder (format "%s" message)) | 111 (mh-mml-forward-message description folder (format "%s" message)) |
110 (mh-mhn-compose-forw description folder message))))) | 112 (mh-mh-forward-message description folder (format "%s" message)))))) |
111 | 113 |
112 ;; To do: | 114 ;; To do: |
113 ;; paragraph code should not fill # lines if MIME enabled. | 115 ;; paragraph code should not fill # lines if MIME enabled. |
114 ;; implement mh-auto-edit-mhn (if non-nil, \\[mh-send-letter] | 116 ;; implement mh-auto-mh-to-mime (if non-nil, \\[mh-send-letter] |
115 ;; invokes mh-edit-mhn automatically before sending.) | 117 ;; invokes mh-mh-to-mime automatically before sending.) |
116 ;; actually, instead of mh-auto-edit-mhn, | 118 ;; actually, instead of mh-auto-mh-to-mime, |
117 ;; should read automhnproc from profile | 119 ;; should read automhnproc from profile |
118 ;; MIME option to mh-forward | 120 ;; MIME option to mh-forward |
119 ;; command to move to content-description insertion point | 121 ;; command to move to content-description insertion point |
120 | 122 |
121 (defvar mh-mhn-args nil | 123 (defvar mh-mh-to-mime-args nil |
122 "Extra arguments to have \\[mh-edit-mhn] pass to the \"mhn\" command. | 124 "Extra arguments for \\[mh-mh-to-mime] to pass to the \"mhbuild\" command. |
123 The arguments are passed to mhn if \\[mh-edit-mhn] is given a | 125 The arguments are passed to \"mhbuild\" if \\[mh-mh-to-mime] is given a prefix |
124 prefix argument. Normally default arguments to mhn are specified in the | 126 argument. Normally default arguments to \"mhbuild\" are specified in the MH |
125 MH profile.") | 127 profile.") |
126 | 128 |
127 (defvar mh-media-type-regexp | 129 (defvar mh-media-type-regexp |
128 (concat (regexp-opt '("text" "image" "audio" "video" "application" | 130 (concat (regexp-opt '("text" "image" "audio" "video" "application" |
129 "multipart" "message") t) | 131 "multipart" "message") t) |
130 "/[-.+a-zA-Z0-9]+") | 132 "/[-.+a-zA-Z0-9]+") |
194 (if (not (re-search-forward mh-media-type-regexp nil t)) | 196 (if (not (re-search-forward mh-media-type-regexp nil t)) |
195 nil | 197 nil |
196 (mh-file-mime-type-substitute (match-string 0) filename))) | 198 (mh-file-mime-type-substitute (match-string 0) filename))) |
197 (kill-buffer tmp-buffer))))))) | 199 (kill-buffer tmp-buffer))))))) |
198 | 200 |
199 ;;; This is needed for Emacs20 which doesn't have mailcap-mime-types. | |
200 (defvar mh-mime-content-types | 201 (defvar mh-mime-content-types |
201 '(("application/mac-binhex40") ("application/msword") | 202 '(("application/mac-binhex40") ("application/msword") |
202 ("application/octet-stream") ("application/pdf") ("application/pgp-keys") | 203 ("application/octet-stream") ("application/pdf") ("application/pgp-keys") |
203 ("application/pgp-signature") ("application/pkcs7-signature") | 204 ("application/pgp-signature") ("application/pkcs7-signature") |
204 ("application/postscript") ("application/rtf") | 205 ("application/postscript") ("application/rtf") |
216 | 217 |
217 ("text/enriched") ("text/html") ("text/plain") ("text/rfc822-headers") | 218 ("text/enriched") ("text/html") ("text/plain") ("text/rfc822-headers") |
218 ("text/richtext") ("text/x-vcard") ("text/xml") | 219 ("text/richtext") ("text/x-vcard") ("text/xml") |
219 | 220 |
220 ("video/mpeg") ("video/quicktime")) | 221 ("video/mpeg") ("video/quicktime")) |
221 "Valid MIME content types. | 222 "Valid MIME content types for Emacs 20. |
222 See documentation for \\[mh-edit-mhn].") | 223 Obsolete; use `mailcap-mime-types'. |
224 | |
225 See also \\[mh-mh-to-mime].") | |
226 | |
227 ;;; Delete mh-minibuffer-read-type and mh-mime-content-types and use | |
228 ;;; mml-minibuffer-read-type when Emacs20 is no longer supported unless we | |
229 ;;; think (mh-file-mime-type) is better than (mm-default-file-encoding). | |
230 | |
231 (defun mh-minibuffer-read-type (filename &optional default) | |
232 "Return the content type associated with the given FILENAME. | |
233 If the \"file\" command exists and recognizes the given file, then its value | |
234 is returned\; otherwise, the user is prompted for a type (see | |
235 `mailcap-mime-types' and for Emacs 20, `mh-mime-content-types'). | |
236 Optional argument DEFAULT is returned if a type isn't entered." | |
237 (mailcap-parse-mimetypes) | |
238 (let* ((default (or default | |
239 (mm-default-file-encoding filename) | |
240 "application/octet-stream")) | |
241 (type (or (mh-file-mime-type filename) | |
242 (completing-read | |
243 (format "Content type (default %s): " default) | |
244 (if (fboundp 'mailcap-mime-types) | |
245 (mapcar 'list (mailcap-mime-types)) | |
246 mh-mime-content-types))))) | |
247 (if (not (equal type "")) | |
248 type | |
249 default))) | |
223 | 250 |
224 ;; RFC 2045 - Multipurpose Internet Mail Extensions (MIME) Part One: | 251 ;; RFC 2045 - Multipurpose Internet Mail Extensions (MIME) Part One: |
225 ;; Format of Internet Message Bodies. | 252 ;; Format of Internet Message Bodies. |
226 ;; RFC 2046 - Multipurpose Internet Mail Extensions (MIME) Part Two: | 253 ;; RFC 2046 - Multipurpose Internet Mail Extensions (MIME) Part Two: |
227 ;; Media Types. | 254 ;; Media Types. |
246 ("url") ; RFC2017 URL scheme MIME access-type Protocol | 273 ("url") ; RFC2017 URL scheme MIME access-type Protocol |
247 ("wais")) ; RFC1738 Wide Area Information Servers | 274 ("wais")) ; RFC1738 Wide Area Information Servers |
248 "Valid MIME access-type values.") | 275 "Valid MIME access-type values.") |
249 | 276 |
250 ;;;###mh-autoload | 277 ;;;###mh-autoload |
251 (defun mh-mhn-compose-insertion (filename type description attributes) | 278 (defun mh-mh-attach-file (filename type description attributes) |
252 "Add a directive to insert a MIME message part from a file. | 279 "Add a tag to insert a MIME message part from a file. |
253 This is the typical way to insert non-text parts in a message. | 280 You are prompted for the FILENAME containing the object, the media TYPE if it |
254 | 281 cannot be determined automatically, and a content DESCRIPTION. In addition, |
255 Arguments are FILENAME, which tells where to find the file, TYPE, the MIME | 282 you are also prompted for additional ATTRIBUTES. |
256 content type, DESCRIPTION, a line of text for the Content-Description field. | 283 |
257 ATTRIBUTES is a comma separated list of name=value pairs that is appended to | 284 See also \\[mh-mh-to-mime]." |
258 the Content-Type field of the attachment. | 285 (interactive (let ((filename (mml-minibuffer-read-file "Attach file: "))) |
259 | |
260 See also \\[mh-edit-mhn]." | |
261 (interactive (let ((filename (read-file-name "Insert contents of: "))) | |
262 (list | 286 (list |
263 filename | 287 filename |
264 (or (mh-file-mime-type filename) | 288 (mh-minibuffer-read-type filename) |
265 (completing-read "Content-Type: " | 289 (mml-minibuffer-read-description) |
266 (if (fboundp 'mailcap-mime-types) | 290 (read-string "Attributes: " |
267 (mapcar 'list (mailcap-mime-types)) | |
268 mh-mime-content-types))) | |
269 (read-string "Content-Description: ") | |
270 (read-string "Content-Attributes: " | |
271 (concat "name=\"" | 291 (concat "name=\"" |
272 (file-name-nondirectory filename) | 292 (file-name-nondirectory filename) |
273 "\""))))) | 293 "\""))))) |
274 (mh-mhn-compose-type filename type description attributes )) | 294 (mh-mh-compose-type filename type description attributes)) |
275 | 295 |
276 (defun mh-mhn-compose-type (filename type | 296 (defun mh-mh-compose-type (filename type |
277 &optional description attributes comment) | 297 &optional description attributes comment) |
278 "Insert a mhn directive to insert a file. | 298 "Insert an MH-style directive to insert a file. |
279 | |
280 The file specified by FILENAME is encoded as TYPE. An optional DESCRIPTION is | 299 The file specified by FILENAME is encoded as TYPE. An optional DESCRIPTION is |
281 used as the Content-Description field, optional set of ATTRIBUTES and an | 300 used as the Content-Description field, optional set of ATTRIBUTES and an |
282 optional COMMENT can also be included." | 301 optional COMMENT can also be included." |
283 (beginning-of-line) | 302 (beginning-of-line) |
284 (insert "#" type) | 303 (insert "#" type) |
290 (and description | 309 (and description |
291 (insert description)) | 310 (insert description)) |
292 (insert "] " (expand-file-name filename)) | 311 (insert "] " (expand-file-name filename)) |
293 (insert "\n")) | 312 (insert "\n")) |
294 | 313 |
295 | 314 ;;;###mh-autoload |
296 ;;;###mh-autoload | 315 (defun mh-mh-compose-anon-ftp (host filename type description) |
297 (defun mh-mhn-compose-anon-ftp (host filename type description) | 316 "Add tag to include anonymous ftp reference to a file. |
298 "Add a directive for a MIME anonymous ftp external body part. | 317 You can even have your message initiate an \"ftp\" transfer when the |
299 This directive tells MH to include a reference to a message/external-body part | 318 recipient reads the message. You are prompted for the remote |
300 retrievable by anonymous FTP. | 319 HOST and FILENAME, the media TYPE, and the content DESCRIPTION. |
301 | 320 |
302 Arguments are HOST and FILENAME, which tell where to find the file, TYPE, the | 321 See also \\[mh-mh-to-mime]." |
303 MIME content type, and DESCRIPTION, a line of text for the Content-description | |
304 header. | |
305 | |
306 See also \\[mh-edit-mhn]." | |
307 (interactive (list | 322 (interactive (list |
308 (read-string "Remote host: ") | 323 (read-string "Remote host: ") |
309 (read-string "Remote filename: ") | 324 (read-string "Remote filename: ") |
310 (completing-read "External Content-Type: " | 325 (mh-minibuffer-read-type "DUMMY-FILENAME") |
311 (if (fboundp 'mailcap-mime-types) | 326 (mml-minibuffer-read-description))) |
312 (mapcar 'list (mailcap-mime-types)) | 327 (mh-mh-compose-external-type "anon-ftp" host filename |
313 mh-mime-content-types)) | 328 type description)) |
314 (read-string "External Content-Description: "))) | 329 |
315 (mh-mhn-compose-external-type "anon-ftp" host filename | 330 ;;;###mh-autoload |
316 type description)) | 331 (defun mh-mh-compose-external-compressed-tar (host filename description) |
317 | 332 "Add tag to include anonymous ftp reference to a compressed tar file. |
318 ;;;###mh-autoload | 333 In addition to retrieving the file via anonymous \"ftp\" as per the |
319 (defun mh-mhn-compose-external-compressed-tar (host filename description) | 334 \\[mh-mh-compose-anon-ftp] command, the file will also be uncompressed and |
320 "Add a directive to include a MIME reference to a compressed tar file. | 335 untarred. You are prompted for the remote HOST and FILENAME and the content |
321 The file should be available via anonymous ftp. This directive tells MH to | 336 DESCRIPTION. |
322 include a reference to a message/external-body part. | 337 |
323 | 338 See also \\[mh-mh-to-mime]." |
324 Arguments are HOST and FILENAME, which tell where to find the file, and | |
325 DESCRIPTION, a line of text for the Content-description header. | |
326 | |
327 See also \\[mh-edit-mhn]." | |
328 (interactive (list | 339 (interactive (list |
329 (read-string "Remote host: ") | 340 (read-string "Remote host: ") |
330 (read-string "Remote filename: ") | 341 (read-string "Remote filename: ") |
331 (read-string "Tar file Content-description: "))) | 342 (mml-minibuffer-read-description))) |
332 (mh-mhn-compose-external-type "anon-ftp" host filename | 343 (mh-mh-compose-external-type "anon-ftp" host filename |
333 "application/octet-stream" | 344 "application/octet-stream" |
334 description | 345 description |
335 "type=tar; conversions=x-compress" | 346 "type=tar; conversions=x-compress" |
336 "mode=image")) | 347 "mode=image")) |
337 | 348 |
338 ;;;###mh-autoload | 349 ;;;###mh-autoload |
339 (defun mh-mhn-compose-external-type (access-type host filename type | 350 (defun mh-mh-compose-external-type (access-type host filename type |
340 &optional description | 351 &optional description |
341 attributes extra-params | 352 attributes parameters |
342 comment) | 353 comment) |
343 "Add a directive to include a MIME reference to a remote file. | 354 "Add tag to refer to a remote file. |
344 The file should be available via anonymous ftp. This directive tells MH to | 355 This command is a general utility for referencing external files. In fact, all |
345 include a reference to a message/external-body part. | 356 of the other commands that insert directives to access external files call |
346 | 357 this command. You are prompted for the ACCESS-TYPE, remote HOST and FILENAME, |
347 Arguments are ACCESS-TYPE, HOST and FILENAME, which tell where to find the | 358 and content TYPE. If you provide a prefix argument, you are also prompted for |
348 file and TYPE which is the MIME Content-Type. Optional arguments include | 359 a content DESCRIPTION, ATTRIBUTES, PARAMETERS, and a COMMENT. |
349 DESCRIPTION, a line of text for the Content-description header, ATTRIBUTES, | 360 |
350 EXTRA-PARAMS, and COMMENT. | 361 See also \\[mh-mh-to-mime]." |
351 | |
352 See also \\[mh-edit-mhn]." | |
353 (interactive (list | 362 (interactive (list |
354 (completing-read "Access Type: " mh-access-types) | 363 (completing-read "Access type: " mh-access-types) |
355 (read-string "Remote host: ") | 364 (read-string "Remote host: ") |
356 (read-string "Remote url-path: ") | 365 (read-string "Remote filename: ") |
357 (completing-read "Content-Type: " | 366 (mh-minibuffer-read-type "DUMMY-FILENAME") |
358 (if (fboundp 'mailcap-mime-types) | 367 (if current-prefix-arg (mml-minibuffer-read-description)) |
359 (mapcar 'list (mailcap-mime-types)) | |
360 mh-mime-content-types)) | |
361 (if current-prefix-arg (read-string "Content-description: ")) | |
362 (if current-prefix-arg (read-string "Attributes: ")) | 368 (if current-prefix-arg (read-string "Attributes: ")) |
363 (if current-prefix-arg (read-string "Extra Parameters: ")) | 369 (if current-prefix-arg (read-string "Parameters: ")) |
364 (if current-prefix-arg (read-string "Comment: ")))) | 370 (if current-prefix-arg (read-string "Comment: ")))) |
365 (beginning-of-line) | 371 (beginning-of-line) |
366 (insert "#@" type) | 372 (insert "#@" type) |
367 (and attributes | 373 (and attributes |
368 (insert "; " attributes)) | 374 (insert "; " attributes)) |
376 (insert "site=" host) | 382 (insert "site=" host) |
377 (insert "; name=" (file-name-nondirectory filename)) | 383 (insert "; name=" (file-name-nondirectory filename)) |
378 (let ((directory (file-name-directory filename))) | 384 (let ((directory (file-name-directory filename))) |
379 (and directory | 385 (and directory |
380 (insert "; directory=\"" directory "\""))) | 386 (insert "; directory=\"" directory "\""))) |
381 (and extra-params | 387 (and parameters |
382 (insert "; " extra-params)) | 388 (insert "; " parameters)) |
383 (insert "\n")) | 389 (insert "\n")) |
384 | 390 |
385 ;;;###mh-autoload | 391 ;;;###mh-autoload |
386 (defun mh-mhn-compose-forw (&optional description folder messages) | 392 (defun mh-mh-forward-message (&optional description folder messages) |
387 "Add a forw directive to this message, to forward a message with MIME. | 393 "Add tag to forward a message. |
388 This directive tells MH to include the named messages in this one. | 394 You are prompted for a content DESCRIPTION, the name of the FOLDER in which |
389 | 395 the messages to forward are located, and the MESSAGES' numbers. |
390 Arguments are DESCRIPTION, a line of text for the Content-description header, | 396 |
391 and FOLDER and MESSAGES, which name the message(s) to be forwarded. | 397 See also \\[mh-mh-to-mime]." |
392 | |
393 See also \\[mh-edit-mhn]." | |
394 (interactive (list | 398 (interactive (list |
395 (read-string "Forw Content-description: ") | 399 (mml-minibuffer-read-description) |
396 (mh-prompt-for-folder "Message from" mh-sent-from-folder nil) | 400 (mh-prompt-for-folder "Message from" mh-sent-from-folder nil) |
397 (read-string (concat "Messages" | 401 (read-string (concat "Messages" |
398 (if (numberp mh-sent-from-msg) | 402 (if (numberp mh-sent-from-msg) |
399 (format " (default %d): " mh-sent-from-msg) | 403 (format " (default %d): " |
404 mh-sent-from-msg) | |
400 ": "))))) | 405 ": "))))) |
401 (beginning-of-line) | 406 (beginning-of-line) |
402 (insert "#forw [") | 407 (insert "#forw [") |
403 (and description | 408 (and description |
404 (not (string= description "")) | 409 (not (string= description "")) |
415 (if (numberp mh-sent-from-msg) | 420 (if (numberp mh-sent-from-msg) |
416 (insert " " (int-to-string mh-sent-from-msg)))) | 421 (insert " " (int-to-string mh-sent-from-msg)))) |
417 (insert "\n")) | 422 (insert "\n")) |
418 | 423 |
419 ;;;###mh-autoload | 424 ;;;###mh-autoload |
420 (defun mh-edit-mhn (&optional extra-args) | 425 (defun mh-mh-to-mime (&optional extra-args) |
421 "Format the current draft for MIME, expanding any mhn directives. | 426 "Compose MIME message from MH-style directives. |
422 | 427 Typically, you send a message with attachments just like any other message. |
423 Process the current draft with the mhn program, which, using directives | 428 However, you may take a sneak preview of the MIME encoding if you wish by |
424 already inserted in the draft, fills in all the MIME components and header | 429 running this command. |
425 fields. | 430 |
426 | 431 If you wish to pass additional arguments to \"mhbuild\" (\"mhn\") to affect |
427 This step is performed automatically when sending the message, but this | 432 how it builds your message, use the `mh-mh-to-mime-args' option. For example, |
428 function may be called manually before sending the draft as well. | 433 you can build a consistency check into the message by setting |
429 | 434 `mh-mh-to-mime-args' to \"-check\". The recipient of your message can then run |
430 The `\\[mh-revert-mhn-edit]' command undoes this command. The arguments in the | 435 \"mhbuild -check\" on the message--\"mhbuild\" (\"mhn\") will complain if the |
431 list `mh-mhn-args' are passed to mhn if this function is passed an optional | 436 message has been corrupted on the way. This command only consults this option |
432 prefix argument EXTRA-ARGS. | 437 when given a prefix argument. |
433 | 438 |
434 For assistance with creating mhn directives to insert various types of | 439 The value of `mh-mh-to-mime-hook' is a list of functions to be called after |
435 components in a message, see \\[mh-mhn-compose-insertion] (generic insertion | 440 the message has been formatted. |
436 from a file), \\[mh-mhn-compose-anon-ftp] (external reference to file via | 441 |
437 anonymous ftp), \\[mh-mhn-compose-external-compressed-tar] \ \(reference to | 442 The effects of this command can be undone by running \\[mh-mh-to-mime-undo]." |
438 compressed tar file via anonymous ftp), and \\[mh-mhn-compose-forw] (forward | |
439 message). | |
440 | |
441 The value of `mh-edit-mhn-hook' is a list of functions to be called, with no | |
442 arguments, after performing the conversion. | |
443 | |
444 The mhn program is part of MH version 6.8 or later." | |
445 (interactive "*P") | 443 (interactive "*P") |
446 (mh-mhn-quote-unescaped-sharp) | 444 (mh-mh-quote-unescaped-sharp) |
447 (save-buffer) | 445 (save-buffer) |
448 (message "mhn editing...") | 446 (message "Running %s..." (if (mh-variant-p 'nmh) "mhbuild" "mhn")) |
449 (cond | 447 (cond |
450 ((mh-variant-p 'nmh) | 448 ((mh-variant-p 'nmh) |
451 (mh-exec-cmd-error nil | 449 (mh-exec-cmd-error nil |
452 "mhbuild" (if extra-args mh-mhn-args) buffer-file-name)) | 450 "mhbuild" |
451 (if extra-args mh-mh-to-mime-args) | |
452 buffer-file-name)) | |
453 (t | 453 (t |
454 (mh-exec-cmd-error (format "mhdraft=%s" buffer-file-name) | 454 (mh-exec-cmd-error (format "mhdraft=%s" buffer-file-name) |
455 "mhn" (if extra-args mh-mhn-args) buffer-file-name))) | 455 "mhn" |
456 (if extra-args mh-mh-to-mime-args) | |
457 buffer-file-name))) | |
456 (revert-buffer t t) | 458 (revert-buffer t t) |
457 (message "mhn editing...done") | 459 (message "Running %s...done" (if (mh-variant-p 'nmh) "mhbuild" "mhn")) |
458 (run-hooks 'mh-edit-mhn-hook)) | 460 (run-hooks 'mh-mh-to-mime-hook)) |
459 | 461 |
460 (defun mh-mhn-quote-unescaped-sharp () | 462 (defun mh-mh-quote-unescaped-sharp () |
461 "Quote `#' characters that haven't been quoted for `mhbuild'. | 463 "Quote `#' characters that haven't been quoted for \"mhbuild\". |
462 If the `#' character is present in the first column, but it isn't part of a | 464 If the `#' character is present in the first column, but it isn't part of a |
463 MHN directive then `mhbuild' gives an error. This function will quote all such | 465 MH-style directive then \"mhbuild\" gives an error. This function will quote |
464 characters." | 466 all such characters." |
465 (save-excursion | 467 (save-excursion |
466 (goto-char (point-min)) | 468 (goto-char (point-min)) |
467 (while (re-search-forward "^#" nil t) | 469 (while (re-search-forward "^#" nil t) |
468 (beginning-of-line) | 470 (beginning-of-line) |
469 (unless (mh-mhn-directive-present-p (point) (line-end-position)) | 471 (unless (mh-mh-directive-present-p (point) (line-end-position)) |
470 (insert "#")) | 472 (insert "#")) |
471 (goto-char (line-end-position))))) | 473 (goto-char (line-end-position))))) |
472 | 474 |
473 ;;;###mh-autoload | 475 ;;;###mh-autoload |
474 (defun mh-revert-mhn-edit (noconfirm) | 476 (defun mh-mh-to-mime-undo (noconfirm) |
475 "Undo the effect of \\[mh-edit-mhn] by reverting to the backup file. | 477 "Undo effects of \\[mh-mh-to-mime]. |
476 Optional non-nil argument NOCONFIRM means don't ask for confirmation." | 478 Optional non-nil argument NOCONFIRM means don't ask for confirmation." |
477 (interactive "*P") | 479 (interactive "*P") |
478 (if (null buffer-file-name) | 480 (if (null buffer-file-name) |
479 (error "Buffer does not seem to be associated with any file")) | 481 (error "Buffer does not seem to be associated with any file")) |
480 (let ((backup-strings '("," "#")) | 482 (let ((backup-strings '("," "#")) |
497 (erase-buffer) | 499 (erase-buffer) |
498 (insert-file-contents backup-file)) | 500 (insert-file-contents backup-file)) |
499 (after-find-file nil))) | 501 (after-find-file nil))) |
500 | 502 |
501 ;;;###mh-autoload | 503 ;;;###mh-autoload |
502 (defun mh-mhn-directive-present-p (&optional begin end) | 504 (defun mh-mh-directive-present-p (&optional begin end) |
503 "Check if the text between BEGIN and END might be a MHN directive. | 505 "Check if the text between BEGIN and END might be a MH-style directive. |
504 The optional argument BEGIN defaults to the beginning of the buffer, while END | 506 The optional argument BEGIN defaults to the beginning of the buffer, while END |
505 defaults to the the end of the buffer." | 507 defaults to the the end of the buffer." |
506 (unless begin (setq begin (point-min))) | 508 (unless begin (setq begin (point-min))) |
507 (unless end (setq end (point-max))) | 509 (unless end (setq end (point-max))) |
508 (save-excursion | 510 (save-excursion |
509 (block 'search-for-mhn-directive | 511 (block 'search-for-mh-directive |
510 (goto-char begin) | 512 (goto-char begin) |
511 (while (re-search-forward "^#" end t) | 513 (while (re-search-forward "^#" end t) |
512 (let ((s (buffer-substring-no-properties (point) (line-end-position)))) | 514 (let ((s (buffer-substring-no-properties (point) (line-end-position)))) |
513 (cond ((equal s "")) | 515 (cond ((equal s "")) |
514 ((string-match "^forw[ \t\n]+" s) | 516 ((string-match "^forw[ \t\n]+" s) |
515 (return-from 'search-for-mhn-directive t)) | 517 (return-from 'search-for-mh-directive t)) |
516 (t (let ((first-token (car (split-string s "[ \t;@]")))) | 518 (t (let ((first-token (car (split-string s "[ \t;@]")))) |
517 (when (and first-token | 519 (when (and first-token |
518 (string-match mh-media-type-regexp | 520 (string-match mh-media-type-regexp |
519 first-token)) | 521 first-token)) |
520 (return-from 'search-for-mhn-directive t))))))) | 522 (return-from 'search-for-mh-directive t))))))) |
521 nil))) | 523 nil))) |
522 | 524 |
523 | 525 |
524 | 526 |
525 ;;; MIME composition functions | 527 ;;; MIME composition functions |
526 | 528 |
527 ;;;###mh-autoload | 529 ;;;###mh-autoload |
528 (defun mh-mml-to-mime () | 530 (defun mh-mml-to-mime () |
529 "Compose MIME message from mml directives. | 531 "Compose MIME message from MML tags. |
530 This step is performed automatically when sending the message, but this | 532 Typically, you send a message with attachments just like any other message. |
531 function may be called manually before sending the draft as well." | 533 However, you may take a sneak preview of the MIME encoding if you wish by |
534 running this command. | |
535 | |
536 This action can be undone by running \\[undo]." | |
532 (interactive) | 537 (interactive) |
533 (require 'message) | 538 (require 'message) |
534 (when mh-gnus-pgp-support-flag ;; This is only needed for PGP | 539 (when mh-pgp-support-flag ;; This is only needed for PGP |
535 (message-options-set-recipient)) | 540 (message-options-set-recipient)) |
536 (let ((saved-text (buffer-string)) | 541 (let ((saved-text (buffer-string)) |
537 (buffer (current-buffer)) | 542 (buffer (current-buffer)) |
538 (modified-flag (buffer-modified-p))) | 543 (modified-flag (buffer-modified-p))) |
539 (condition-case err (mml-to-mime) | 544 (condition-case err (mml-to-mime) |
571 (defun mh-mml-query-cryptographic-method () | 576 (defun mh-mml-query-cryptographic-method () |
572 "Read the cryptographic method to use." | 577 "Read the cryptographic method to use." |
573 (if current-prefix-arg | 578 (if current-prefix-arg |
574 (let ((def (or (car mh-mml-cryptographic-method-history) | 579 (let ((def (or (car mh-mml-cryptographic-method-history) |
575 mh-mml-method-default))) | 580 mh-mml-method-default))) |
576 (completing-read (format "Method: [%s] " def) | 581 (completing-read (format "Method (default %s): " def) |
577 '(("pgp") ("pgpmime") ("smime")) | 582 '(("pgp") ("pgpmime") ("smime")) |
578 nil t nil 'mh-mml-cryptographic-method-history def)) | 583 nil t nil 'mh-mml-cryptographic-method-history def)) |
579 mh-mml-method-default)) | 584 mh-mml-method-default)) |
580 | 585 |
581 ;;;###mh-autoload | 586 ;;;###mh-autoload |
582 (defun mh-mml-attach-file (&optional disposition) | 587 (defun mh-mml-attach-file (&optional disposition) |
583 "Attach a file to the outgoing MIME message. | 588 "Add a tag to insert a MIME message part from a file. |
584 The file is not inserted or encoded until you send the message with | 589 You are prompted for the filename containing the object, the media type if it |
585 `\\[mh-send-letter]'. | 590 cannot be determined automatically, a content description and the disposition |
586 Message disposition is \"inline\" or \"attachment\" and is prompted for if | 591 of the attachment. |
587 DISPOSITION is nil. | 592 |
588 | 593 This is basically `mml-attach-file' from Gnus, modified such that a prefix |
589 This is basically `mml-attach-file' from gnus, modified such that a prefix | |
590 argument yields an `inline' disposition and Content-Type is determined | 594 argument yields an `inline' disposition and Content-Type is determined |
591 automatically." | 595 automatically." |
592 (let* ((file (mml-minibuffer-read-file "Attach file: ")) | 596 (let* ((file (mml-minibuffer-read-file "Attach file: ")) |
593 (type (or (mh-file-mime-type file) | 597 (type (mh-minibuffer-read-type file)) |
594 (completing-read "Content-Type: " | |
595 (if (fboundp 'mailcap-mime-types) | |
596 (mapcar 'list (mailcap-mime-types)) | |
597 mh-mime-content-types)))) | |
598 (description (mml-minibuffer-read-description)) | 598 (description (mml-minibuffer-read-description)) |
599 (dispos (or disposition | 599 (dispos (or disposition |
600 (completing-read "Disposition: [attachment] " | 600 (mml-minibuffer-read-disposition type)))) |
601 '(("attachment")("inline")) | |
602 nil t nil nil | |
603 "attachment")))) | |
604 (mml-insert-empty-tag 'part 'type type 'filename file | 601 (mml-insert-empty-tag 'part 'type type 'filename file |
605 'disposition dispos 'description description))) | 602 'disposition dispos 'description description))) |
606 | 603 |
607 (defvar mh-identity-pgg-default-user-id) | 604 (defvar mh-identity-pgg-default-user-id) |
608 | 605 |
609 (defun mh-secure-message (method mode &optional identity) | 606 (defun mh-secure-message (method mode &optional identity) |
610 "Add directive to Encrypt/Sign an entire message. | 607 "Add tag to encrypt or sign message. |
611 METHOD should be one of: \"pgpmime\", \"pgp\", \"smime\". | 608 METHOD should be one of: \"pgpmime\", \"pgp\", \"smime\". |
612 MODE should be one of: \"sign\", \"encrypt\", \"signencrypt\", \"none\". | 609 MODE should be one of: \"sign\", \"encrypt\", \"signencrypt\", \"none\". |
613 IDENTITY is optionally the default-user-id to use." | 610 IDENTITY is optionally the default-user-id to use." |
614 (if (not mh-gnus-pgp-support-flag) | 611 (if (not mh-pgp-support-flag) |
615 (error "Sorry. Your version of gnus does not support PGP/GPG") | 612 (error "Your version of Gnus does not support PGP/GPG") |
616 ;; Check the arguments | 613 ;; Check the arguments |
617 (let ((valid-methods (list "pgpmime" "pgp" "smime")) | 614 (let ((valid-methods (list "pgpmime" "pgp" "smime")) |
618 (valid-modes (list "sign" "encrypt" "signencrypt" "none"))) | 615 (valid-modes (list "sign" "encrypt" "signencrypt" "none"))) |
619 (if (not (member method valid-methods)) | 616 (if (not (member method valid-methods)) |
620 (error "Sorry. METHOD \"%s\" is invalid" method)) | 617 (error "Method \"%s\" is invalid" method)) |
621 (if (not (member mode valid-modes)) | 618 (if (not (member mode valid-modes)) |
622 (error "Sorry. MODE \"%s\" is invalid" mode)) | 619 (error "Mode \"%s\" is invalid" mode)) |
623 (mml-unsecure-message) | 620 (mml-unsecure-message) |
624 (if (not (string= mode "none")) | 621 (if (not (string= mode "none")) |
625 (save-excursion | 622 (save-excursion |
626 (goto-char (point-min)) | 623 (goto-char (point-min)) |
627 (mh-goto-header-end 1) | 624 (mh-goto-header-end 1) |
630 'sender mh-identity-pgg-default-user-id) | 627 'sender mh-identity-pgg-default-user-id) |
631 (mml-insert-tag 'secure 'method method 'mode mode))))))) | 628 (mml-insert-tag 'secure 'method method 'mode mode))))))) |
632 | 629 |
633 ;;;###mh-autoload | 630 ;;;###mh-autoload |
634 (defun mh-mml-unsecure-message (&optional ignore) | 631 (defun mh-mml-unsecure-message (&optional ignore) |
635 "Remove any secure message directives. | 632 "Remove any secure message tags. |
636 The IGNORE argument is not used." | 633 The argument IGNORE is not used." |
637 (interactive "P") | 634 (interactive "P") |
638 (if (not mh-gnus-pgp-support-flag) | 635 (if (not mh-pgp-support-flag) |
639 (error "Sorry. Your version of gnus does not support PGP/GPG") | 636 (error "Your version of Gnus does not support PGP/GPG") |
640 (mml-unsecure-message))) | 637 (mml-unsecure-message))) |
641 | 638 |
642 ;;;###mh-autoload | 639 ;;;###mh-autoload |
643 (defun mh-mml-secure-message-sign (method) | 640 (defun mh-mml-secure-message-sign (method) |
644 "Add security directive to sign the entire message using METHOD." | 641 "Add tag to sign the message. |
642 A proper multipart message is created for you when you send the message. Use | |
643 the \\[mh-mml-unsecure-message] command to remove this tag. Use a prefix | |
644 argument METHOD to be prompted for one of the possible security methods | |
645 (see `mh-mml-method-default')." | |
645 (interactive (list (mh-mml-query-cryptographic-method))) | 646 (interactive (list (mh-mml-query-cryptographic-method))) |
646 (mh-secure-message method "sign" mh-identity-pgg-default-user-id)) | 647 (mh-secure-message method "sign" mh-identity-pgg-default-user-id)) |
647 | 648 |
648 ;;;###mh-autoload | 649 ;;;###mh-autoload |
649 (defun mh-mml-secure-message-encrypt (method) | 650 (defun mh-mml-secure-message-encrypt (method) |
650 "Add security directive to encrypt the entire message using METHOD." | 651 "Add tag to encrypt the message. |
652 A proper multipart message is created for you when you send the message. Use | |
653 the \\[mh-mml-unsecure-message] command to remove this tag. Use a prefix | |
654 argument METHOD to be prompted for one of the possible security methods | |
655 (see `mh-mml-method-default')." | |
651 (interactive (list (mh-mml-query-cryptographic-method))) | 656 (interactive (list (mh-mml-query-cryptographic-method))) |
652 (mh-secure-message method "encrypt" mh-identity-pgg-default-user-id)) | 657 (mh-secure-message method "encrypt" mh-identity-pgg-default-user-id)) |
653 | 658 |
654 ;;;###mh-autoload | 659 ;;;###mh-autoload |
655 (defun mh-mml-secure-message-signencrypt (method) | 660 (defun mh-mml-secure-message-signencrypt (method) |
656 "Add security directive to encrypt and sign the entire message using METHOD." | 661 "Add tag to encrypt and sign the message. |
662 A proper multipart message is created for you when you send the message. Use | |
663 the \\[mh-mml-unsecure-message] command to remove this tag. Use a prefix | |
664 argument METHOD to be prompted for one of the possible security methods | |
665 (see `mh-mml-method-default')." | |
657 (interactive (list (mh-mml-query-cryptographic-method))) | 666 (interactive (list (mh-mml-query-cryptographic-method))) |
658 (mh-secure-message method "signencrypt" mh-identity-pgg-default-user-id)) | 667 (mh-secure-message method "signencrypt" mh-identity-pgg-default-user-id)) |
659 | 668 |
660 ;;;###mh-autoload | 669 ;;;###mh-autoload |
661 (defun mh-mml-directive-present-p () | 670 (defun mh-mml-tag-present-p () |
662 "Check if the current buffer has text which may be an MML directive." | 671 "Check if the current buffer has text which may be a MML tag." |
663 (save-excursion | 672 (save-excursion |
664 (goto-char (point-min)) | 673 (goto-char (point-min)) |
665 (re-search-forward | 674 (re-search-forward |
666 "\\(<#part\\(.\\|\n\\)*>[ \n\t]*<#/part>\\|^<#secure.+>$\\)" | 675 "\\(<#part\\(.\\|\n\\)*>[ \n\t]*<#/part>\\|^<#secure.+>$\\)" |
667 nil t))) | 676 nil t))) |
680 (mm-destroy-parts (mh-mime-handles mime-data)) | 689 (mm-destroy-parts (mh-mime-handles mime-data)) |
681 (remhash (current-buffer) mh-globals-hash)))) | 690 (remhash (current-buffer) mh-globals-hash)))) |
682 | 691 |
683 ;;;###mh-autoload | 692 ;;;###mh-autoload |
684 (defun mh-destroy-postponed-handles () | 693 (defun mh-destroy-postponed-handles () |
685 "Free MIME data for externally displayed mime parts." | 694 "Free MIME data for externally displayed MIME parts." |
686 (let ((mime-data (mh-buffer-data))) | 695 (let ((mime-data (mh-buffer-data))) |
687 (when mime-data | 696 (when mime-data |
688 (mm-destroy-parts (mh-mime-handles mime-data))) | 697 (mm-destroy-parts (mh-mime-handles mime-data))) |
689 (remhash (current-buffer) mh-globals-hash))) | 698 (remhash (current-buffer) mh-globals-hash))) |
690 | 699 |
734 (assoc t font-lock-maximum-size))))))) | 743 (assoc t font-lock-maximum-size))))))) |
735 (or (not (numberp max)) (>= (/ max 8) (buffer-size))))) | 744 (or (not (numberp max)) (>= (/ max 8) (buffer-size))))) |
736 | 745 |
737 ;;;###mh-autoload | 746 ;;;###mh-autoload |
738 (defun mh-display-smileys () | 747 (defun mh-display-smileys () |
739 "Function to display smileys." | 748 "Display smileys." |
740 (when (and mh-graphical-smileys-flag (mh-small-show-buffer-p)) | 749 (when (and mh-graphical-smileys-flag (mh-small-show-buffer-p)) |
741 (mh-funcall-if-exists smiley-region (point-min) (point-max)))) | 750 (mh-funcall-if-exists smiley-region (point-min) (point-max)))) |
742 | 751 |
743 ;;;###mh-autoload | 752 ;;;###mh-autoload |
744 (defun mh-display-emphasis () | 753 (defun mh-display-emphasis () |
745 "Function to display graphical emphasis." | 754 "Display graphical emphasis." |
746 (when (and mh-graphical-emphasis-flag (mh-small-show-buffer-p)) | 755 (when (and mh-graphical-emphasis-flag (mh-small-show-buffer-p)) |
747 (flet ((article-goto-body ())) ; shadow this function to do nothing | 756 (flet ((article-goto-body ())) ; shadow this function to do nothing |
748 (save-excursion | 757 (save-excursion |
749 (goto-char (point-min)) | 758 (goto-char (point-min)) |
750 (article-emphasize))))) | 759 (article-emphasize))))) |
797 ;;;###mh-autoload | 806 ;;;###mh-autoload |
798 (defun mh-mime-save-parts (arg) | 807 (defun mh-mime-save-parts (arg) |
799 "Store the MIME parts of the current message. | 808 "Store the MIME parts of the current message. |
800 If ARG, prompt for directory, else use that specified by the variable | 809 If ARG, prompt for directory, else use that specified by the variable |
801 `mh-mime-save-parts-default-directory'. These directories may be superseded by | 810 `mh-mime-save-parts-default-directory'. These directories may be superseded by |
802 mh_profile directives, since this function calls on mhstore or mhn to do the | 811 MH profile components, since this function calls on mhstore to do the work." |
803 actual storing." | |
804 (interactive "P") | 812 (interactive "P") |
805 (let ((msg (if (eq major-mode 'mh-show-mode) | 813 (let ((msg (if (eq major-mode 'mh-show-mode) |
806 (mh-show-buffer-message-number) | 814 (mh-show-buffer-message-number) |
807 (mh-get-msg-num t))) | 815 (mh-get-msg-num t))) |
808 (folder (if (eq major-mode 'mh-show-mode) | 816 (folder (if (eq major-mode 'mh-show-mode) |
938 (cond ((null handle) nil) | 946 (cond ((null handle) nil) |
939 ((not (stringp (car handle))) | 947 ((not (stringp (car handle))) |
940 (mh-mime-display-single handle)) | 948 (mh-mime-display-single handle)) |
941 ((equal (car handle) "multipart/alternative") | 949 ((equal (car handle) "multipart/alternative") |
942 (mh-mime-display-alternative (cdr handle))) | 950 (mh-mime-display-alternative (cdr handle))) |
943 ((and mh-gnus-pgp-support-flag | 951 ((and mh-pgp-support-flag |
944 (or (equal (car handle) "multipart/signed") | 952 (or (equal (car handle) "multipart/signed") |
945 (equal (car handle) "multipart/encrypted"))) | 953 (equal (car handle) "multipart/encrypted"))) |
946 (mh-mime-display-security handle)) | 954 (mh-mime-display-security handle)) |
947 (t (mh-mime-display-mixed (cdr handle))))) | 955 (t (mh-mime-display-mixed (cdr handle))))) |
948 | 956 |
1045 "image")) | 1053 "image")) |
1046 (mm-inlinable-p handle) | 1054 (mm-inlinable-p handle) |
1047 (mm-inlined-p handle))))))) | 1055 (mm-inlined-p handle))))))) |
1048 (save-restriction | 1056 (save-restriction |
1049 (narrow-to-region (point) (if (eobp) (point) (1+ (point)))) | 1057 (narrow-to-region (point) (if (eobp) (point) (1+ (point)))) |
1050 (cond ((and mh-gnus-pgp-support-flag | 1058 (cond ((and mh-pgp-support-flag |
1051 (equal type "application/pgp-signature")) | 1059 (equal type "application/pgp-signature")) |
1052 nil) ; skip signatures as they are already handled... | 1060 nil) ; skip signatures as they are already handled... |
1053 ((not displayp) | 1061 ((not displayp) |
1054 (insert "\n") | 1062 (insert "\n") |
1055 (mh-insert-mime-button handle (mh-mime-part-index handle) nil)) | 1063 (mh-insert-mime-button handle (mh-mime-part-index handle) nil)) |