emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scratch/lexical-gnus 9e96fca 4/6: * lisp/gnus/mm-encode.el (mm-default-f


From: Stefan Monnier
Subject: scratch/lexical-gnus 9e96fca 4/6: * lisp/gnus/mm-encode.el (mm-default-file-type): New name
Date: Sat, 30 Jan 2021 12:35:26 -0500 (EST)

branch: scratch/lexical-gnus
commit 9e96fca53dbd9f52b69341dbb5d9849fd2b5a16c
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * 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.
---
 lisp/gnus/gnus-art.el   | 2 +-
 lisp/gnus/gnus-dired.el | 6 +++---
 lisp/gnus/mm-encode.el  | 9 ++++++---
 lisp/gnus/mml.el        | 8 ++++----
 lisp/mail/sendmail.el   | 6 +++---
 lisp/mh-e/mh-mime.el    | 4 ++--
 6 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index ca24e6f..7ae4e58 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -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")
diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index e78163a..e412dd0 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -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))))
 
diff --git a/lisp/gnus/mm-encode.el b/lisp/gnus/mm-encode.el
index 8bd3e0b..31d6131 100644
--- a/lisp/gnus/mm-encode.el
+++ b/lisp/gnus/mm-encode.el
@@ -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))))
 
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index 752dede..acde958 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -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
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index d2601c3..cd07166 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -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))
 
 
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index 7bdf743f..70df9e6 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]