update.
[elisp/semi.git] / mime-edit.el
index 43b7e27..c4f69d2 100644 (file)
 ;;;
 
 (defconst mime-edit-version-string
-  `,(concat "SEMI "
-           (mapconcat #'number-to-string (cdr semi-version) ".")
-           " - \"" (car semi-version) "\""))
+  `,(concat (car mime-module-version) " "
+           (mapconcat #'number-to-string (cddr mime-module-version) ".")
+           " - \"" (cadr mime-module-version) "\""))
 
 
 ;;; @ variables
@@ -237,8 +237,18 @@ To insert a signature file automatically, call the function
     )
   "*Alist of content-type, subtype, parameters and its values.")
 
-(defvar mime-file-types
-  '(("\\.rtf$"
+(defcustom mime-file-types
+  '(("\\.txt$"
+     "text"    "plain"         nil
+     nil
+     "inline"          (("filename" . file))
+     )
+    ("\\.pln$"
+     "text"    "plain"         nil
+     nil
+     "inline"          (("filename" . file))
+     )
+    ("\\.rtf$"
      "text"    "richtext"      nil
      nil
      nil               nil)
@@ -362,15 +372,56 @@ To insert a signature file automatically, call the function
      "attachment"      (("filename" . file))
      )
     ("\\.signature"
-     "text"    "plain"         nil     nil)
+     "text"    "plain"         nil     nil     nil     nil)
     (".*"
      "application" "octet-stream" nil
      nil
-     "attachment"      (("filename" . file))
-     )
+     "attachment"      (("filename" . file)))
     )
   "*Alist of file name, types, parameters, and default encoding.
-If encoding is nil, it is determined from its contents.")
+If encoding is nil, it is determined from its contents."
+  :type `(repeat
+         (list regexp
+               ;; primary-type
+               (choice :tag "Primary-Type"
+                       ,@(nconc (mapcar (lambda (cell)
+                                          (list 'item (car cell))
+                                          )
+                                        mime-content-types)
+                                '(string)))
+               ;; subtype
+               (choice :tag "Sub-Type"
+                       ,@(nconc
+                          (apply #'nconc
+                                 (mapcar (lambda (cell)
+                                           (mapcar (lambda (cell)
+                                                     (list 'item (car cell))
+                                                     )
+                                                   (cdr cell)))
+                                         mime-content-types))
+                          '(string)))
+               ;; parameters
+               (repeat :tag "Parameters of Content-Type field"
+                       (cons string (choice string symbol)))
+               ;; content-transfer-encoding
+               (choice :tag "Encoding"
+                       ,@(cons
+                          '(const nil)
+                          (mapcar (lambda (cell)
+                                    (list 'item (car cell))
+                                    )
+                                  mime-file-encoding-method-alist)))
+               ;; disposition-type
+               (choice :tag "Disposition-Type"
+                       (item nil)
+                       (item "inline")
+                       (item "attachment")
+                       string)
+               ;; parameters
+               (repeat :tag "Parameters of Content-Disposition field"
+                       (cons string (choice string symbol)))
+               ))
+  :group 'mime-edit)
 
 
 ;;; @@ about charset, encoding and transfer-level
@@ -960,26 +1011,27 @@ just return to previous mode."
     (princ (documentation 'mime-edit-mode))
     (print-help-return-message)))
 
-(defun mime-edit-insert-text ()
+(defun mime-edit-insert-text (&optional subtype)
   "Insert a text message.
-Charset is automatically obtained from the `charsets-mime-charset-alist'."
+Charset is automatically obtained from the `charsets-mime-charset-alist'.
+If optional argument SUBTYPE is not nil, text/SUBTYPE tag is inserted."
   (interactive)
-  (let ((ret (mime-edit-insert-tag "text" nil nil)))
-  (if ret
-      (progn
-       (if (looking-at mime-edit-single-part-tag-regexp)
-           (progn
-             ;; Make a space between the following message.
-             (insert "\n")
-             (forward-char -1)
-             ))
-       (if (and (member (cadr ret) '("enriched" "richtext"))
-                (fboundp 'enriched-mode)
-                )
-           (enriched-mode t)
-         (if (boundp 'enriched-mode)
-             (enriched-mode -1)
-           ))))))
+  (let ((ret (mime-edit-insert-tag "text" subtype nil)))
+    (when ret
+      (if (looking-at mime-edit-single-part-tag-regexp)
+         (progn
+           ;; Make a space between the following message.
+           (insert "\n")
+           (forward-char -1)
+           ))
+      (if (and (member (cadr ret) '("enriched" "richtext"))
+              (fboundp 'enriched-mode)
+              )
+         (enriched-mode t)
+       (if (boundp 'enriched-mode)
+           (enriched-mode -1)
+         ))
+      )))
 
 (defun mime-edit-insert-file (file &optional verbose)
   "Insert a message from a file."
@@ -1080,8 +1132,9 @@ Charset is automatically obtained from the `charsets-mime-charset-alist'."
   (let ((signature-insert-hook
          (function
           (lambda ()
-            (apply (function mime-edit-insert-tag)
-                   (mime-find-file-type signature-file-name))
+           (let ((items (mime-find-file-type signature-file-name)))
+             (apply (function mime-edit-insert-tag)
+                    (car items) (cadr items) (list (caddr items))))
             )))
         )
     (insert-signature arg)
@@ -2480,17 +2533,16 @@ Content-Type: message/partial; id=%s; number=%d; total=%d\n%s\n"
   "Quitting method for mime-view."
   (let ((temp mime-raw-buffer)
        buf)
-    (mime-view-kill-buffer)
+    (mime-preview-kill-buffer)
     (set-buffer temp)
     (setq buf mime-edit-buffer)
     (kill-buffer temp)
     (switch-to-buffer buf)
     ))
 
-(set-alist 'mime-view-quitting-method-alist
+(set-alist 'mime-preview-quitting-method-alist
           'mime-temp-message-mode
-          (function mime-edit-quitting-method)
-          )
+          #'mime-edit-quitting-method)
 
 
 ;;; @ edit again