1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-16 19:00:55 -08:00

* lisp/gnus/mm-encode.el (mm-default-file-type): New name

Rename from misleading `mm-default-file-encoding`.
(mm-default-file-encoding): Redefine as obsolete alias.

* lisp/mail/sendmail.el (mail-add-attachment):
* lisp/mh-e/mh-mime.el (mh-minibuffer-read-type):
* lisp/gnus/gnus-art.el (gnus-mime-view-part-as-type-internal):
* lisp/gnus/gnus-dired.el (gnus-dired-attach):
* lisp/gnus/mml.el (mml-generate-mime-1, mml-minibuffer-read-type)
(mml-attach-file): Use the new name.
This commit is contained in:
Stefan Monnier 2021-01-30 00:40:21 -05:00
parent d6f8bce6d4
commit 9e96fca53d
6 changed files with 19 additions and 16 deletions

View file

@ -5206,7 +5206,7 @@ Use CMD as the process."
(mail-content-type-get (mm-handle-type handle) 'name)
;; Content-Disposition: attachment; filename=...
(cdr (assq 'filename (cdr (mm-handle-disposition handle))))))
(def-type (and name (mm-default-file-encoding name))))
(def-type (and name (mm-default-file-type name))))
(or (and def-type (cons def-type 0))
(and handle
(equal (mm-handle-media-supertype handle) "text")

View file

@ -40,7 +40,6 @@
(require 'dired)
(autoload 'mml-attach-file "mml")
(autoload 'mm-default-file-encoding "mm-decode");; Shift this to `mailcap.el'?
(autoload 'mailcap-extension-to-mime "mailcap")
(autoload 'mailcap-mime-info "mailcap")
@ -166,8 +165,9 @@ filenames."
(goto-char (point-max)) ;attach at end of buffer
(while files-to-attach
(mml-attach-file (car files-to-attach)
(or (mm-default-file-encoding (car files-to-attach))
"application/octet-stream") nil)
(or (mm-default-file-type (car files-to-attach))
"application/octet-stream")
nil)
(setq files-to-attach (cdr files-to-attach)))
(message "Attached file(s) %s" files-str))))

View file

@ -98,9 +98,12 @@ This variable should never be set directly, but bound before a call to
boundary))
;;;###autoload
(defun mm-default-file-encoding (file)
"Return a default encoding for FILE."
(if (not (string-match "\\.[^.]+$" file))
(define-obsolete-function-alias 'mm-default-file-encoding
#'mm-default-file-type "future") ;Old bad name.
;;;###autoload
(defun mm-default-file-type (file)
"Return a default content type for FILE."
(if (not (string-match "\\.[^.]+\\'" file))
"application/octet-stream"
(mailcap-extension-to-mime (match-string 0 file))))

View file

@ -617,7 +617,7 @@ type detected."
(filename (cdr (assq 'filename cont)))
(type (or (cdr (assq 'type cont))
(if filename
(or (mm-default-file-encoding filename)
(or (mm-default-file-type filename)
"application/octet-stream")
"text/plain")))
(charset (cdr (assq 'charset cont)))
@ -775,7 +775,7 @@ type detected."
(insert "Content-Type: "
(or (cdr (assq 'type cont))
(if name
(or (mm-default-file-encoding name)
(or (mm-default-file-type name)
"application/octet-stream")
"text/plain"))
"\n")
@ -1304,7 +1304,7 @@ If not set, `default-directory' will be used."
(require 'mailcap)
(mailcap-parse-mimetypes)
(let* ((default (or default
(mm-default-file-encoding name)
(mm-default-file-type name)
;; Perhaps here we should check what the file
;; looks like, and offer text/plain if it looks
;; like text/plain.
@ -1426,7 +1426,7 @@ will be computed and used."
(interactive
(let* ((file (mml-minibuffer-read-file "Attach file: "))
(type (if current-prefix-arg
(or (mm-default-file-encoding file)
(or (mm-default-file-type file)
"application/octet-stream")
(mml-minibuffer-read-type file)))
(description (if current-prefix-arg

View file

@ -1800,14 +1800,14 @@ If the current line has `mail-yank-prefix', insert it on the new line."
(declare-function mml-attach-file "mml"
(file &optional type description disposition))
(declare-function mm-default-file-encoding "mm-encode" (file))
(defun mail-add-attachment (file)
"Add FILE as a MIME attachment to the end of the mail message being composed."
(interactive "fAttach file: ")
(mml-attach-file file
(or (mm-default-file-encoding file)
"application/octet-stream") nil)
(or (mm-default-file-type file)
"application/octet-stream")
nil)
(setq mail-encode-mml t))

View file

@ -1725,14 +1725,14 @@ a type (see `mailcap-mime-types').
Optional argument DEFAULT is returned if a type isn't entered."
(mailcap-parse-mimetypes)
(let* ((default (or default
(mm-default-file-encoding filename)
(mm-default-file-type filename)
"application/octet-stream"))
(probed-type (mh-file-mime-type filename))
(type (or (and (not (equal probed-type "application/octet-stream"))
probed-type)
(completing-read
(format "Content type (default %s): " default)
(mapcar 'list (mailcap-mime-types))))))
(mapcar #'list (mailcap-mime-types))))))
(if (not (equal type ""))
type
default)))