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.
(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")
(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")
(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))))
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))))
(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)))
(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")
(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.
(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
(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))
\f
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)))