diff options
| author | Bill Wohler | 2009-01-27 06:36:54 +0000 |
|---|---|---|
| committer | Bill Wohler | 2009-01-27 06:36:54 +0000 |
| commit | 55f56e6aedad12d2eb8d2dec182f0a587b279100 (patch) | |
| tree | 53fea8699e76b45ca849b2c7c8ea65de9c349005 /lisp | |
| parent | 170bc4f7d83b8bce7eddcf1f3c769776b1d6986d (diff) | |
| download | emacs-55f56e6aedad12d2eb8d2dec182f0a587b279100.tar.gz emacs-55f56e6aedad12d2eb8d2dec182f0a587b279100.zip | |
(mh-mm-merge-handles)
(mh-mm-set-handle-multipart-parameter, mh-mm-inline-text-vcard)
(mh-mml-minibuffer-read-disposition, mh-mm-save-part): Update with
code from Gnus 5.11 (closes SF #2235022).
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/mh-e/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/mh-e/mh-gnus.el | 88 |
2 files changed, 55 insertions, 40 deletions
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog index fd44338e033..efdf22af0d5 100644 --- a/lisp/mh-e/ChangeLog +++ b/lisp/mh-e/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2009-01-27 Bill Wohler <wohler@newt.com> | ||
| 2 | |||
| 3 | * mh-gnus.el (mh-mm-merge-handles) | ||
| 4 | (mh-mm-set-handle-multipart-parameter, mh-mm-inline-text-vcard) | ||
| 5 | (mh-mml-minibuffer-read-disposition, mh-mm-save-part): Update with | ||
| 6 | code from Gnus 5.11 (closes SF #2235022). | ||
| 7 | |||
| 1 | 2009-01-26 Stephen Gildea <gildea@stop.mail-abuse.org> | 8 | 2009-01-26 Stephen Gildea <gildea@stop.mail-abuse.org> |
| 2 | 9 | ||
| 3 | * mh-e.el (mh-pack-folder-hook): New variable. | 10 | * mh-e.el (mh-pack-folder-hook): New variable. |
diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el index a983977a101..16351e8f5df 100644 --- a/lisp/mh-e/mh-gnus.el +++ b/lisp/mh-e/mh-gnus.el | |||
| @@ -38,6 +38,7 @@ | |||
| 38 | (mh-require 'mml nil t) | 38 | (mh-require 'mml nil t) |
| 39 | 39 | ||
| 40 | ;; Copy of function from gnus-util.el. | 40 | ;; Copy of function from gnus-util.el. |
| 41 | ;; TODO This is not in Gnus 5.11. | ||
| 41 | (defun-mh mh-gnus-local-map-property gnus-local-map-property (map) | 42 | (defun-mh mh-gnus-local-map-property gnus-local-map-property (map) |
| 42 | "Return a list suitable for a text property list specifying keymap MAP." | 43 | "Return a list suitable for a text property list specifying keymap MAP." |
| 43 | (cond ((featurep 'xemacs) (list 'keymap map)) | 44 | (cond ((featurep 'xemacs) (list 'keymap map)) |
| @@ -46,29 +47,34 @@ | |||
| 46 | 47 | ||
| 47 | ;; Copy of function from mm-decode.el. | 48 | ;; Copy of function from mm-decode.el. |
| 48 | (defun-mh mh-mm-merge-handles mm-merge-handles (handles1 handles2) | 49 | (defun-mh mh-mm-merge-handles mm-merge-handles (handles1 handles2) |
| 49 | (append (if (listp (car handles1)) handles1 (list handles1)) | 50 | (append |
| 50 | (if (listp (car handles2)) handles2 (list handles2)))) | 51 | (if (listp (car handles1)) |
| 52 | handles1 | ||
| 53 | (list handles1)) | ||
| 54 | (if (listp (car handles2)) | ||
| 55 | handles2 | ||
| 56 | (list handles2)))) | ||
| 51 | 57 | ||
| 52 | ;; Copy of function from mm-decode.el. | 58 | ;; Copy of function from mm-decode.el. |
| 53 | (defun-mh mh-mm-set-handle-multipart-parameter | 59 | (defun-mh mh-mm-set-handle-multipart-parameter |
| 54 | mm-set-handle-multipart-parameter (handle parameter value) | 60 | mm-set-handle-multipart-parameter (handle parameter value) |
| 55 | ;; HANDLE could be a CTL. | 61 | ;; HANDLE could be a CTL. |
| 56 | (if handle | 62 | (when handle |
| 57 | (put-text-property 0 (length (car handle)) parameter value | 63 | (put-text-property 0 (length (car handle)) parameter value |
| 58 | (car handle)))) | 64 | (car handle)))) |
| 59 | 65 | ||
| 60 | ;; Copy of function from mm-view.el. | 66 | ;; Copy of function from mm-view.el. |
| 61 | (defun-mh mh-mm-inline-text-vcard mm-inline-text-vcard (handle) | 67 | (defun-mh mh-mm-inline-text-vcard mm-inline-text-vcard (handle) |
| 62 | (let (buffer-read-only) | 68 | (let ((inhibit-read-only t)) |
| 63 | (mm-insert-inline | 69 | (mm-insert-inline |
| 64 | handle | 70 | handle |
| 65 | (concat "\n-- \n" | 71 | (concat "\n-- \n" |
| 66 | (ignore-errors | 72 | (ignore-errors |
| 67 | (if (fboundp 'vcard-pretty-print) | 73 | (if (fboundp 'vcard-pretty-print) |
| 68 | (vcard-pretty-print (mm-get-part handle)) | 74 | (vcard-pretty-print (mm-get-part handle)) |
| 69 | (vcard-format-string | 75 | (vcard-format-string |
| 70 | (vcard-parse-string (mm-get-part handle) | 76 | (vcard-parse-string (mm-get-part handle) |
| 71 | 'vcard-standard-filter)))))))) | 77 | 'vcard-standard-filter)))))))) |
| 72 | 78 | ||
| 73 | ;; Function from mm-decode.el used in PGP messages. Just define it with older | 79 | ;; Function from mm-decode.el used in PGP messages. Just define it with older |
| 74 | ;; Gnus to avoid compiler warning. | 80 | ;; Gnus to avoid compiler warning. |
| @@ -119,41 +125,43 @@ | |||
| 119 | 125 | ||
| 120 | ;; Copy of function in mml.el. | 126 | ;; Copy of function in mml.el. |
| 121 | (defun-mh mh-mml-minibuffer-read-disposition | 127 | (defun-mh mh-mml-minibuffer-read-disposition |
| 122 | mml-minibuffer-read-disposition (type &optional default) | 128 | mml-minibuffer-read-disposition (type &optional default filename) |
| 123 | (unless default (setq default | 129 | (unless default |
| 124 | (if (and (string-match "\\`text/" type) | 130 | (setq default (mml-content-disposition type filename))) |
| 125 | (not (string-match "\\`text/rtf\\'" type))) | ||
| 126 | "inline" | ||
| 127 | "attachment"))) | ||
| 128 | (let ((disposition (completing-read | 131 | (let ((disposition (completing-read |
| 129 | (format "Disposition (default %s): " default) | 132 | (format "Disposition (default %s): " default) |
| 130 | '(("attachment") ("inline") ("")) | 133 | '(("attachment") ("inline") ("")) |
| 131 | nil t nil nil default))) | 134 | nil t nil nil default))) |
| 132 | (if (not (equal disposition "")) | 135 | (if (not (equal disposition "")) |
| 133 | disposition | 136 | disposition |
| 134 | default))) | 137 | default))) |
| 135 | 138 | ||
| 136 | ;; This is mm-save-part from Gnus 5.10 since that function in emacs21.2 is | 139 | ;; This is mm-save-part from Gnus 5.11 since that function in Emacs |
| 137 | ;; buggy (the args to read-file-name are incorrect). When all supported | 140 | ;; 21.2 is buggy (the args to read-file-name are incorrect) and the |
| 138 | ;; versions of Emacs come with at least Gnus 5.10, we can delete this | 141 | ;; version in Emacs 22 is not consistent with C-x C-w in that you |
| 139 | ;; function and rename calls to mh-mm-save-part to mm-save-part. | 142 | ;; can't just specify a directory and have the right thing happen. |
| 140 | (defun mh-mm-save-part (handle) | 143 | (defun mh-mm-save-part (handle &optional prompt) |
| 141 | "Write HANDLE to a file." | 144 | "Write HANDLE to a file. |
| 142 | (let ((name (mail-content-type-get (mm-handle-type handle) 'name)) | 145 | PROMPT overrides the default one used to ask user for a file name." |
| 143 | (filename (mail-content-type-get | 146 | (let ((filename (or (mail-content-type-get |
| 144 | (mm-handle-disposition handle) 'filename)) | 147 | (mm-handle-disposition handle) 'filename) |
| 145 | file) | 148 | (mail-content-type-get |
| 149 | (mm-handle-type handle) 'name))) | ||
| 150 | file) | ||
| 146 | (when filename | 151 | (when filename |
| 147 | (setq filename (file-name-nondirectory filename))) | 152 | (setq filename (gnus-map-function mm-file-name-rewrite-functions |
| 148 | (setq file (read-file-name "Save MIME part to: " | 153 | (file-name-nondirectory filename)))) |
| 149 | (or mm-default-directory | 154 | (setq file |
| 150 | default-directory) | 155 | (read-file-name (or prompt "Save MIME part to: ") |
| 151 | nil nil (or filename name ""))) | 156 | (or mm-default-directory default-directory) |
| 157 | nil nil (or filename ""))) | ||
| 152 | (setq mm-default-directory (file-name-directory file)) | 158 | (setq mm-default-directory (file-name-directory file)) |
| 153 | (and (or (not (file-exists-p file)) | 159 | (and (or (not (file-exists-p file)) |
| 154 | (yes-or-no-p (format "File %s already exists; overwrite? " | 160 | (yes-or-no-p (format "File %s already exists; overwrite? " |
| 155 | file))) | 161 | file))) |
| 156 | (mm-save-part-to-file handle file)))) | 162 | (progn |
| 163 | (mm-save-part-to-file handle file) | ||
| 164 | file)))) | ||
| 157 | 165 | ||
| 158 | (defun mh-mm-text-html-renderer () | 166 | (defun mh-mm-text-html-renderer () |
| 159 | "Find the renderer Gnus is using to display text/html MIME parts." | 167 | "Find the renderer Gnus is using to display text/html MIME parts." |