diff options
Diffstat (limited to 'lisp/gnus/mml.el')
-rw-r--r-- | lisp/gnus/mml.el | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el index d5588971e59..1df4e28f13d 100644 --- a/lisp/gnus/mml.el +++ b/lisp/gnus/mml.el @@ -27,8 +27,9 @@ (require 'mm-encode) (require 'mm-decode) (require 'mml-sec) -(eval-when-compile (require 'cl)) +(eval-when-compile (require 'cl-lib)) (eval-when-compile (require 'url)) +(eval-when-compile (require 'gnus-util)) (autoload 'message-make-message-id "message") (declare-function gnus-setup-posting-charset "gnus-msg" (group)) @@ -47,7 +48,6 @@ (defvar gnus-article-mime-handles) (defvar gnus-newsrc-hashtb) -(defvar message-default-charset) (defvar message-deletable-headers) (defvar message-options) (defvar message-posting-charset) @@ -548,6 +548,9 @@ be \"related\" or \"alternate\"." ">"))))))) cont)))) +(autoload 'image-property "image") + +;; FIXME presumably (built-in) ImageMagick could replace exiftool? (defun mml--possibly-alter-image (file-name image) (if (or (null image) (not (consp image)) @@ -699,9 +702,7 @@ be \"related\" or \"alternate\"." filename))))) (t (let ((contents (cdr (assq 'contents cont)))) - (if (if (featurep 'xemacs) - (string-match "[^\000-\377]" contents) - (multibyte-string-p contents)) + (if (multibyte-string-p contents) (progn (set-buffer-multibyte t) (insert contents) @@ -795,12 +796,12 @@ be \"related\" or \"alternate\"." (if (setq recipients (cdr (assq 'recipients cont))) (message-options-set 'message-recipients recipients)) (let ((style (mml-signencrypt-style - (first (or sign-item encrypt-item))))) + (car (or sign-item encrypt-item))))) ;; check if: we're both signing & encrypting, both methods ;; are the same (why would they be different?!), and that ;; the signencrypt style allows for combined operation. - (if (and sign-item encrypt-item (equal (first sign-item) - (first encrypt-item)) + (if (and sign-item encrypt-item (equal (car sign-item) + (car encrypt-item)) (equal style 'combined)) (funcall (nth 1 encrypt-item) cont t) ;; otherwise, revert to the old behavior. @@ -812,7 +813,7 @@ be \"related\" or \"alternate\"." (defun mml-compute-boundary (cont) "Return a unique boundary that does not exist in CONT." (let ((mml-boundary (funcall mml-boundary-function - (incf mml-multipart-number)))) + (cl-incf mml-multipart-number)))) (unless mml-inhibit-compute-boundary ;; This function tries again and again until it has found ;; a unique boundary. @@ -832,7 +833,7 @@ be \"related\" or \"alternate\"." (when (re-search-forward (concat "^--" (regexp-quote mml-boundary)) nil t) (setq mml-boundary (funcall mml-boundary-function - (incf mml-multipart-number))) + (cl-incf mml-multipart-number))) (throw 'not-unique nil)))) ((eq (car cont) 'multipart) (mapc 'mml-compute-boundary-1 (cddr cont)))) @@ -903,8 +904,14 @@ be \"related\" or \"alternate\"." (or disposition (mml-content-disposition type (cdr (assq 'filename cont))))) (when parameters - (mml-insert-parameter-string - cont mml-content-disposition-parameters)) + (let ((cont (copy-sequence cont))) + ;; Set the file name to what's specified by the user. + (when-let ((recipient-filename (cdr (assq 'recipient-filename cont)))) + (setcdr cont + (cons (cons 'filename recipient-filename) + (cdr cont)))) + (mml-insert-parameter-string + cont mml-content-disposition-parameters))) (insert "\n")) (unless (eq encoding '7bit) (insert (format "Content-Transfer-Encoding: %s\n" encoding))) @@ -1011,8 +1018,7 @@ If HANDLES is non-nil, use it instead reparsing the buffer." ;; Skip past any From_ headers. (while (looking-at "From ") (forward-line 1)) - (let ((mail-parse-charset message-default-charset)) - (mail-encode-encoded-word-buffer))) + (mail-encode-encoded-word-buffer)) (message-encode-message-body)) (defun mml-insert-mime (handle &optional no-markup) @@ -1151,7 +1157,7 @@ If HANDLES is non-nil, use it instead reparsing the buffer." (easy-menu-define mml-menu mml-mode-map "" - `("Attachments" + '("Attachments" ["Attach File..." mml-attach-file :help "Attach a file at point"] ["Attach Buffer..." mml-attach-buffer :help "Attach a buffer to the outgoing message"] @@ -1544,7 +1550,6 @@ Should be adopted if code in `message-send-mail' is changed." (defvar mml-preview-buffer nil) -(autoload 'gnus-make-hashtable "gnus-util") (autoload 'widget-button-press "wid-edit" nil t) (declare-function widget-event-point "wid-edit" (event)) ;; If gnus-buffer-configuration is bound this is loaded. |