(mml-minibuffer-read-disposition): New function.
authorReiner Steib <Reiner.Steib@gmx.de>
Tue, 30 Dec 2003 19:06:43 +0000 (19:06 +0000)
committerReiner Steib <Reiner.Steib@gmx.de>
Tue, 30 Dec 2003 19:06:43 +0000 (19:06 +0000)
(mml-attach-file): Use it.
(mml-preview): Added MIME preview to gnus-buffers.

lisp/ChangeLog
lisp/mml.el

index 7d937e0..bf4b721 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-30  Reiner Steib  <Reiner.Steib@gmx.de>
+
+       * mml.el (mml-minibuffer-read-disposition): New function.
+       (mml-attach-file): Use it.
+       (mml-preview): Added MIME preview to gnus-buffers.
+
 2003-12-30  Jesper Harder  <harder@ifa.au.dk>
 
        * gnus-sum.el (gnus-summary-make-menu-bar): Add ellipses.
index 5e35f16..7128da4 100644 (file)
@@ -936,6 +936,19 @@ See Info node `(emacs-mime)Composing'.
       (setq description nil))
     description))
 
+(defun mml-minibuffer-read-disposition (type &optional default)
+  (let* ((default (or default
+                     (if (string-match "^text/.*" type)
+                         "inline"
+                       "attachment")))
+        (disposition (completing-read "Disposition: "
+                                      '(("attachment") ("inline") (""))
+                                      nil
+                                      nil)))
+    (if (not (equal disposition ""))
+       disposition
+      default)))
+
 (defun mml-quote-region (beg end)
   "Quote the MML tags in the region."
   (interactive "r")
@@ -978,7 +991,7 @@ See Info node `(emacs-mime)Composing'.
 
 ;;; Attachment functions.
 
-(defun mml-attach-file (file &optional type description)
+(defun mml-attach-file (file &optional type description disposition)
   "Attach a file to the outgoing MIME message.
 The file is not inserted or encoded until you send the message with
 `\\[message-send-and-exit]' or `\\[message-send]'.
@@ -989,10 +1002,14 @@ description of the attachment."
   (interactive
    (let* ((file (mml-minibuffer-read-file "Attach file: "))
          (type (mml-minibuffer-read-type file))
-         (description (mml-minibuffer-read-description)))
-     (list file type description)))
-  (mml-insert-empty-tag 'part 'type type 'filename file
-                       'disposition "attachment" 'description description))
+         (description (mml-minibuffer-read-description))
+         (disposition (mml-minibuffer-read-disposition type)))
+     (list file type description disposition)))
+  (mml-insert-empty-tag 'part
+                       'type type
+                       'filename file
+                       'disposition (or disposition "attachment")
+                       'description description))
 
 (defun mml-attach-buffer (buffer &optional type description)
   "Attach a buffer to the outgoing MIME message.
@@ -1061,6 +1078,8 @@ If RAW, don't highlight the article."
       (switch-to-buffer (generate-new-buffer
                         (concat (if raw "*Raw MIME preview of "
                                   "*MIME preview of ") (buffer-name))))
+      (when (boundp 'gnus-buffers)
+       (push (current-buffer) gnus-buffers))
       (erase-buffer)
       (insert-buffer-substring buf)
       (mml-preview-insert-mail-followup-to)