]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/mh-mime.el
(comint-postoutput-scroll-to-bottom): Cope with unset
[gnu-emacs] / lisp / mail / mh-mime.el
index 4bd403ec3fb9d450aa6e6e0a2b8ca57c65b334a7..5c715878ebdedd60445c88a4e03482922d1de945 100644 (file)
@@ -1,9 +1,9 @@
 ;;; mh-mime --- mh-e support for composing MIME messages
-;; Time-stamp: <94/11/18 17:48:19 gildea>
+;; Time-stamp: <95/08/19 16:45:17 gildea>
 
 ;; Copyright (C) 1993, 1995 Free Software Foundation, Inc.
 
-;; This file is part of GNU Emacs.
+;; This file is part of mh-e, part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING.  If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
 
-;;; Internal support for mh-e package.
-;;; Support for generating an mhn composition file.
-;;; MIME is supported only by MH 6.8 or later.
+;; Internal support for mh-e package.
+;; Support for generating an mhn composition file.
+;; MIME is supported only by MH 6.8 or later.
 
 ;;; Change Log:
 
-;; $Id: mh-mime.el,v 1.2 1995/04/09 22:30:35 kwzh Exp kwzh $
+;; $Id: mh-mime.el,v 1.6 1996/01/14 07:34:30 erik Exp rms $
 
 ;;; Code:
 
@@ -53,6 +54,7 @@ MH profile.")
 (defvar mh-edit-mhn-hook nil
   "Invoked on the formatted letter by \\<mh-letter-mode-map>\\[mh-edit-mhn].")
 
+;;;###autoload
 (defvar mh-mime-content-types
   '(("text/plain") ("text/richtext")
     ("multipart/mixed") ("multipart/alternative") ("multipart/digest")
@@ -62,22 +64,26 @@ MH profile.")
     ("image/jpeg") ("image/gif")
     ("audio/basic")
     ("video/mpeg"))
-  "Legal MIME content types.")
+  "Legal MIME content types.  See documentation for \\[mh-edit-mhn].")
 
-(defun mh-mhn-compose-insertion (pathname type description)
-  "Add a directive to insert a message part from a file.
+(defun mh-mhn-compose-insertion (filename type description attributes)
+  "Add a directive to insert a MIME message part from a file.
 This is the typical way to insert non-text parts in a message.
-Arguments are PATHNAME, which tells where to find the file, TYPE, the
+Arguments are FILENAME, which tells where to find the file, TYPE, the
 MIME content type, and DESCRIPTION, a line of text for the
 Content-description header.  See also \\[mh-edit-mhn]."
-  (interactive (list
-               (read-file-name "Insert contents of: ")
-               (completing-read "Content-type: "
+  (interactive (let ((filename (read-file-name "Insert contents of: "))) 
+                (list
+                 filename
+                 (completing-read "Content-type: "
                                 mh-mime-content-types nil nil nil)
-               (read-string "Content-description: ")))
-  (mh-mhn-compose-type pathname type description))
+                 (read-string "Content-description: ")
+                 (read-string "Content-Attributes: " 
+                              (concat "name=" 
+                                      (file-name-nondirectory filename))))))
+  (mh-mhn-compose-type filename type description attributes ))
 
-(defun mh-mhn-compose-type (pathname type
+(defun mh-mhn-compose-type (filename type
                            &optional description attributes comment)
   (beginning-of-line)
   (insert "#" type)
@@ -88,45 +94,45 @@ Content-description header.  See also \\[mh-edit-mhn]."
   (insert " [")
   (and description
        (insert description))
-  (insert "] " (expand-file-name pathname))
+  (insert "] " (expand-file-name filename))
   (insert "\n"))
 
 
-(defun mh-mhn-compose-anon-ftp (host pathname type description)
-  "Add a directive for an anonymous ftp external body part.
+(defun mh-mhn-compose-anon-ftp (host filename type description)
+  "Add a directive for a MIME anonymous ftp external body part.
 This directive tells MH to include a reference to a
 message/external-body part retrievable by anonymous FTP.  Arguments
-are HOST and PATHNAME, which tell where to find the file, TYPE, the
+are HOST and FILENAME, which tell where to find the file, TYPE, the
 MIME content type, and DESCRIPTION, a line of text for the
 Content-description header.  See also \\[mh-edit-mhn]."
   (interactive (list
                (read-string "Remote host: ")
-               (read-string "Remote pathname: ")
+               (read-string "Remote filename: ")
                (completing-read "External Content-type: "
                                 mh-mime-content-types nil nil nil)
                (read-string "External Content-description: ")))
-  (mh-mhn-compose-external-type "anon-ftp" host pathname
+  (mh-mhn-compose-external-type "anon-ftp" host filename
                                type description))
 
-(defun mh-mhn-compose-external-compressed-tar (host pathname description)
-  "Add a directive to include a reference to a compressed tar file.
+(defun mh-mhn-compose-external-compressed-tar (host filename description)
+  "Add a directive to include a MIME reference to a compressed tar file.
 The file should be available via anonymous ftp.  This directive
 tells MH to include a reference to a message/external-body part.
-Arguments are HOST and PATHNAME, which tell where to find the file, and
+Arguments are HOST and FILENAME, which tell where to find the file, and
 DESCRIPTION, a line of text for the Content-description header.
 See also \\[mh-edit-mhn]."
   (interactive (list
                (read-string "Remote host: ")
-               (read-string "Remote pathname: ")
+               (read-string "Remote filename: ")
                (read-string "Tar file Content-description: ")))
-  (mh-mhn-compose-external-type "anon-ftp" host pathname
+  (mh-mhn-compose-external-type "anon-ftp" host filename
                                "application/octet-stream"
                                description
                                "type=tar; conversions=x-compress"
                                "mode=image"))
 
 
-(defun mh-mhn-compose-external-type (access-type host pathname type
+(defun mh-mhn-compose-external-type (access-type host filename type
                                     &optional description
                                     attributes extra-params comment)
   (beginning-of-line)
@@ -141,17 +147,17 @@ See also \\[mh-edit-mhn]."
   (insert "] ")
   (insert "access-type=" access-type "; ")
   (insert "site=" host)
-  (insert "; name=" (file-name-nondirectory pathname))
-  (insert "; directory=\"" (file-name-directory pathname) "\"")
+  (insert "; name=" (file-name-nondirectory filename))
+  (insert "; directory=\"" (file-name-directory filename) "\"")
   (and extra-params
        (insert "; " extra-params))
   (insert "\n"))
 
 (defun mh-mhn-compose-forw (&optional description folder messages)
-  "Add a forw directive to this message.
+  "Add a forw directive to this message, to forward a message with MIME.
 This directive tells MH to include the named messages in this one.
 Arguments are DESCRIPTION, a line of text for the Content-description header,
-FOLDER and MESSAGES, which name the message(s) to be forwarded.
+and FOLDER and MESSAGES, which name the message(s) to be forwarded.
 See also \\[mh-edit-mhn]."
   (interactive (list
                (read-string "Forw Content-description: ")