;;; tm-edit.el --- Simple MIME Composer for GNU Emacs
-;; Copyright (C) 1993 .. 1996 Free Software Foundation, Inc.
+;; Copyright (C) 1993,1994,1995,1996,1997 Free Software Foundation, Inc.
;; Author: UMEDA Masanobu <umerin@mse.kyutech.ac.jp>
;; MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
;; Created: 1994/08/21 renamed from mime.el
-;; Version: $Revision: 7.98 $
+;; Version: $Revision: 7.105 $
;; Keywords: mail, news, MIME, multimedia, multilingual
;; This file is part of tm (Tools for MIME).
;; resulted in RFC 1468 (ISO-2022-JP charset for MIME). In order to
;; enable multilingual capability in single text message in MIME,
;; charset of multilingual text written in Mule is declared as either
-;; `ISO-2022-JP-2' [RFC 1554] or `ISO-2022-INT-1'. Mule is required
-;; for reading the such messages.
+;; `ISO-2022-JP-2' [RFC 1554]. Mule is required for reading the such
+;; messages.
;; This MIME composer can work with Mail mode, mh-e letter Mode, and
;; News mode. First of all, you need the following autoload
;;
;;--[[text/plain]]
;; This is also a plain text. But, it is explicitly specified as is.
+;;--[[text/plain; charset=ISO-8859-1]]
+;; This is also a plain text. But charset is specified as iso-8859-1.
;;
-;;--[[text/plain; charset=ISO-2022-JP]]
-;; \e$B$3$l$O\e(B charset \e$B$r\e(B ISO-2022-JP \e$B$K;XDj$7$?F|K\8l$N\e(B plain \e$B%F%-%9%H$G$9\e(B.
-;;
-;;--[[text/richtext]]
+;; ¡Hola! Buenos días. ¿Cómo está usted?
+;;--[[text/enriched]]
;; <center>This is a richtext.</center>
;;
;;--[[image/gif][base64]]^M...image encoded in base64 comes here...
;;;
(defconst mime-editor/RCS-ID
- "$Id: tm-edit.el,v 7.98 1996/12/23 14:49:34 morioka Exp $")
+ "$Id: tm-edit.el,v 7.105 1997/02/13 14:29:14 morioka Exp $")
(defconst mime-editor/version (get-version-string mime-editor/RCS-ID))
)
("\\.tar\\.gz$"
"application" "octet-stream" (("type" . "tar+gzip"))
- nil
+ "base64"
"attachment" (("filename" . file))
)
("\\.tgz$"
"application" "octet-stream" (("type" . "tar+gzip"))
- nil
+ "base64"
"attachment" (("filename" . file))
)
("\\.tar\\.Z$"
"application" "octet-stream" (("type" . "tar+compress"))
- nil
+ "base64"
"attachment" (("filename" . file))
)
("\\.taz$"
"application" "octet-stream" (("type" . "tar+compress"))
- nil
+ "base64"
"attachment" (("filename" . file))
)
("\\.gz$"
"application" "octet-stream" (("type" . "gzip"))
- nil
+ "base64"
"attachment" (("filename" . file))
)
("\\.Z$"
"application" "octet-stream" (("type" . "compress"))
- nil
+ "base64"
"attachment" (("filename" . file))
)
("\\.lzh$"
"application" "octet-stream" (("type" . "lha"))
- nil
+ "base64"
"attachment" (("filename" . file))
)
("\\.zip$"
"application" "zip" nil
- nil
+ "base64"
"attachment" (("filename" . file))
)
("\\.diff$"
;;;
(defvar mime-editor/transfer-level 7
- "*A number of network transfer level. It should be bigger than 7.")
+ "*A number of network transfer level. It should be bigger than 7.")
(make-variable-buffer-local 'mime-editor/transfer-level)
(defvar mime-editor/transfer-level-string
(defvar mime-editor/encrypting-type 'pgp-elkins
"*PGP encrypting type (pgp-elkins, pgp-kazu or nil). [tm-edit.el]")
-(defvar mime-editor/pgp-sign-function 'tm:mc-pgp-sign-region)
-(defvar mime-editor/pgp-encrypt-function 'tm:mc-pgp-encrypt-region)
-(defvar mime-editor/traditional-pgp-sign-function 'mc-pgp-sign-region)
-(defvar mime-editor/pgp-insert-public-key-function 'mc-insert-public-key)
-
-(autoload mime-editor/pgp-sign-function "tm-edit-mc")
-(autoload mime-editor/pgp-encrypt-function "tm-edit-mc")
-(autoload mime-editor/traditional-pgp-sign-function "mc-pgp")
-(autoload mime-editor/pgp-insert-public-key-function "mc-toplev")
-
;;; @@ about tag
;;;
In this mode, basically, the message is composed in the tagged MIME
format. The message tag looks like:
- `--[[text/plain; charset=ISO-2022-JP][7bit]]'.
+ --[[text/plain; charset=ISO-2022-JP][7bit]]
The tag specifies the MIME content type, subtype, optional parameters
and transfer encoding of the message following the tag. Messages
which key is MIME charset and value is coding-system.
Following commands are available in addition to major mode commands:
+
+\[make single part\]
\\[mime-editor/insert-text] insert a text message.
\\[mime-editor/insert-file] insert a (binary) file.
\\[mime-editor/insert-external] insert a reference to external body.
\\[mime-editor/insert-message] insert a mail or news message.
\\[mime-editor/insert-mail] insert a mail message.
\\[mime-editor/insert-signature] insert a signature file at end.
+\\[mime-editor/insert-key] insert PGP public key.
\\[mime-editor/insert-tag] insert a new MIME tag.
+
+\[make enclosure (maybe multipart)\]
\\[mime-editor/enclose-alternative-region] enclose as multipart/alternative.
\\[mime-editor/enclose-parallel-region] enclose as multipart/parallel.
\\[mime-editor/enclose-mixed-region] enclose as multipart/mixed.
\\[mime-editor/enclose-digest-region] enclose as multipart/digest.
\\[mime-editor/enclose-signed-region] enclose as PGP signed.
\\[mime-editor/enclose-encrypted-region] enclose as PGP encrypted.
-\\[mime-editor/insert-key] insert PGP public key.
+\\[mime-editor/enclose-quote-region] enclose as verbose mode (to avoid to expand tags)
+
+\[other commands\]
+\\[mime-editor/set-transfer-level-7bit] set transfer-level as 7.
+\\[mime-editor/set-transfer-level-8bit] set transfer-level as 8.
+\\[mime-editor/set-split] set message splitting mode.
+\\[mime-editor/set-sign] set PGP-sign mode.
+\\[mime-editor/set-encrypt] set PGP-encryption mode.
\\[mime-editor/preview-message] preview editing MIME message.
\\[mime-editor/exit] exit and translate into a MIME compliant message.
-\\[mime-editor/maybe-translate] exit and translate if in MIME mode, then split.
\\[mime-editor/help] show this help.
+\\[mime-editor/maybe-translate] exit and translate if in MIME mode, then split.
Additional commands are available in some major modes:
C-c C-c exit, translate and run the original command.
--[[text/plain]]
This is also a plain text. But, it is explicitly specified as
is.
- --[[text/plain; charset=ISO-2022-JP]]
- \e$B$3$l$O\e(B charset \e$B$r\e(B ISO-2022-JP \e$B$K;XDj$7$?F|K\8l$N\e(B plain \e$B%F%-%9\e(B
- \e$B%H$G$9\e(B.
- --[[text/richtext]]
- <center>This is a richtext.</center>
- --[[image/gif][base64]]^M...image encoded in base64 here...
- --[[audio/basic][base64]]^M...audio encoded in base64 here...
+ --[[text/plain; charset=ISO-8859-1]]
+ This is also a plain text. But charset is specified as
+ iso-8859-1.
+
+ ¡Hola! Buenos días. ¿Cómo está usted?
+ --[[text/enriched]]
+ This is a <bold>enriched text</bold>.
+ --[[image/gif][base64]]...image encoded in base64 here...
+ --[[audio/basic][base64]]...audio encoded in base64 here...
User customizable variables (not documented all of them):
mime-prefix
mime-ignore-trailing-spaces
Trailing white spaces in a message body are ignored if non-nil.
- mime-auto-fill-header
- Fill header fields that contain encoded-words if non-nil.
-
mime-auto-hide-body
Hide a non-textual body message encoded in base64 after insertion
if non-nil.
+ mime-editor/transfer-level
+ A number of network transfer level. It should be bigger than 7.
+ If you are in 8bit-through environment, please set 8.
+
mime-editor/voice-recorder
Specifies a function to record a voice message and encode it.
The function `mime-editor/voice-recorder-for-sun' is for Sun
;; Restore previous state.
(setq mime/editor-mode-flag nil)
(cond (running-xemacs
- (delete-menu-item (list mime-editor/menu-title)))
+ (if (featurep 'menubar)
+ (delete-menu-item (list mime-editor/menu-title))))
(t
(use-local-map mime/editor-mode-old-local-map)))
(defun mime-editor/insert-text ()
"Insert a text message.
-Charset is automatically obtained from the `mime/lc-charset-alist'."
+Charset is automatically obtained from the `charsets-mime-charset-alist'."
(interactive)
(let ((ret (mime-editor/insert-tag "text" nil nil)))
(if ret
(setq type (mime-prompt-for-type type)
subtype (mime-prompt-for-subtype type subtype)
))
- (if (interactive-p)
+ (if (or (interactive-p) verbose)
(setq encoding (mime-prompt-for-encoding encoding))
)
(if (or (consp parameters) (stringp disposition-type))
(defun mime-prompt-for-encoding (default)
"Ask for Content-Transfer-Encoding. [tm-edit.el]"
- (let ((ret
- (completing-read
- (concat "What transfer encoding"
- (if default
- (concat " (default "
- (if (string-equal default "")
- "\"\""
- default)
- ")"
- ))
- ": ")
- mime-file-encoding-method-alist nil t nil)
- ))
- (if (string= ret "")
- default
- ret)))
+ (let (encoding)
+ (while (string=
+ (setq encoding
+ (completing-read
+ "What transfer encoding: "
+ mime-file-encoding-method-alist nil t default)
+ )
+ ""))
+ encoding))
\f
;;; @ Translate the tagged MIME messages into a MIME compliant message.
(insert (format "Content-Transfer-Encoding: %s\n" encoding))
)
(insert "\n")
- (or (funcall mime-editor/pgp-sign-function
+ (or (funcall (pgp-function 'mime-sign)
(point-min)(point-max) nil nil pgp-boundary)
(throw 'mime-editor/error 'pgp-error)
)
(insert (format "Content-Transfer-Encoding: %s\n" encoding))
)
(insert "\n")
- (or (funcall mime-editor/pgp-encrypt-function
+ (or (funcall (pgp-function 'encrypt)
recipients (point-min) (point-max) from)
(throw 'mime-editor/error 'pgp-error)
)
)
(insert "\n")
(or (as-binary-process
- (funcall mime-editor/traditional-pgp-sign-function
+ (funcall (pgp-function 'traditional-sign)
beg (point-max)))
(throw 'mime-editor/error 'pgp-error)
)
)
(insert "\n")
(or (as-binary-process
- (funcall mime-editor/pgp-encrypt-function
+ (funcall (pgp-function 'encrypt)
recipients beg (point-max) nil 'maybe)
)
(throw 'mime-editor/error 'pgp-error)
(interactive "P")
(mime-editor/insert-tag "application" "pgp-keys")
(mime-editor/define-encoding "7bit")
- (funcall mime-editor/pgp-insert-public-key-function)
+ (funcall (pgp-function 'insert-key))
)
(setq type ctype)
)
(cond
- ((string-equal type "multipart")
+ ((string= ctype "application/pgp-signature")
+ (delete-region (point-min)(point-max))
+ )
+ ((string= type "multipart")
(let* ((boundary (assoc-value "boundary" params))
(boundary-pat
(concat "\n--" (regexp-quote boundary) "[ \t]*\n"))