;;; tm-edit.el --- Simple MIME Composer for GNU Emacs
;;;
;;; Copyright (C) 1993 UMEDA Masanobu
-;;; Copyright (C) 1994,1995 MORIOKA Tomohiko
+;;; Copyright (C) 1994 .. 1996 MORIOKA Tomohiko
;;;
;;; 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.41 $
+;;; Version: $Revision: 7.42 $
;;; Keywords: mail, news, MIME, multimedia, multilingual
;;;
;;; This file is part of tm (Tools for MIME).
;;;
(defconst mime-editor/RCS-ID
- "$Id: tm-edit.el,v 7.41 1996/01/18 17:49:17 morioka Exp $")
+ "$Id: tm-edit.el,v 7.42 1996/02/02 17:20:00 morioka Exp $")
(defconst mime-editor/version (get-version-string mime-editor/RCS-ID))
(defconst mime-editor/menu-title "MIME-Edit")
(defconst mime-editor/menu-list
- (nconc
- '((mime-help "Describe MIME editor mode" mime-editor/help)
- (file "Insert File" mime-editor/insert-file)
- (external "Insert External" mime-editor/insert-external)
- (voice "Insert Voice" mime-editor/insert-voice)
- (message "Insert Message" mime-editor/insert-message)
- (mail "Insert Mail" mime-editor/insert-mail)
- (signature "Insert Signature" mime-editor/insert-signature)
- (text "Insert Text" mime-editor/insert-text)
- (tag "Insert Tag" mime-editor/insert-tag)
- (alternative "Enclose as alternative"
- mime-editor/enclose-alternative-region)
- (parallel "Enclose as parallel" mime-editor/enclose-parallel-region)
- (mixed "Enclose as serial" mime-editor/enclose-mixed-region)
- (digest "Enclose as digest" mime-editor/enclose-digest-region)
- (signed "Enclose as signed" mime-editor/enclose-signed-region)
- (encrypted "Enclose as encrypted" mime-editor/enclose-encrypted-region)
- (key "Insert Public Key" mime-editor/insert-key)
- (split "About split" mime-editor/set-split)
- )
- (if (and (featurep 'mailcrypt)
- (not (or mime-editor/signing-type mime-editor/encrypting-type)))
- '((sign "About sign" mime-editor/set-sign)
- (encrypt "About encryption" mime-editor/set-encrypt)
- ))
- '((preview "Preview Message" mime-editor/preview-message))
- )
+ '((mime-help "Describe MIME editor mode" mime-editor/help)
+ (file "Insert File" mime-editor/insert-file)
+ (external "Insert External" mime-editor/insert-external)
+ (voice "Insert Voice" mime-editor/insert-voice)
+ (message "Insert Message" mime-editor/insert-message)
+ (mail "Insert Mail" mime-editor/insert-mail)
+ (signature "Insert Signature" mime-editor/insert-signature)
+ (text "Insert Text" mime-editor/insert-text)
+ (tag "Insert Tag" mime-editor/insert-tag)
+ (alternative "Enclose as alternative"
+ mime-editor/enclose-alternative-region)
+ (parallel "Enclose as parallel" mime-editor/enclose-parallel-region)
+ (mixed "Enclose as serial" mime-editor/enclose-mixed-region)
+ (digest "Enclose as digest" mime-editor/enclose-digest-region)
+ (signed "Enclose as signed" mime-editor/enclose-signed-region)
+ (encrypted "Enclose as encrypted" mime-editor/enclose-encrypted-region)
+ (key "Insert Public Key" mime-editor/insert-key)
+ (split "About split" mime-editor/set-split)
+ (sign "About sign" mime-editor/set-sign)
+ (encrypt "About encryption" mime-editor/set-encrypt)
+ (preview "Preview Message" mime-editor/preview-message)
+ )
"MIME-edit menubar entry.")
(defun mime-editor/define-menu-for-emacs19 ()
(interactive)
(if (catch 'mime-editor/error
(save-excursion
+ (mime-editor/pgp-enclose-buffer)
(mime/encode-message-header)
(mime-editor/translate-body)
- (mime-editor/pgp-processing)
))
(progn
(undo)
(y-or-n-p "Do you want to sign?")
))
(if arg
- (progn
- (setq mime-editor/pgp-processing 'sign)
- (message "This message will be signed.")
+ (if mime-editor/signing-type
+ (progn
+ (setq mime-editor/pgp-processing 'sign)
+ (message "This message will be signed.")
+ )
+ (message "Please specify signing type.")
)
(if (eq mime-editor/pgp-processing 'sign)
(setq mime-editor/pgp-processing nil)
(y-or-n-p "Do you want to encrypt?")
))
(if arg
- (progn
- (setq mime-editor/pgp-processing 'encrypt)
- (message "This message will be encrypt.")
+ (if mime-editor/encrypting-type
+ (progn
+ (setq mime-editor/pgp-processing 'encrypt)
+ (message "This message will be encrypt.")
+ )
+ (message "Please specify encrypting type.")
)
(if (eq mime-editor/pgp-processing 'encrypt)
(setq mime-editor/pgp-processing nil)
(defvar mime-editor/pgp-processing nil)
(make-variable-buffer-local 'mime-editor/pgp-processing)
-(defun mime-editor/call-mc (command)
- (let* ((header (rfc822/get-header-string-except
- "^Content-Type:" mail-header-separator)))
- (goto-char (point-min))
- (if (search-forward mail-header-separator)
- (replace-match "")
- )
- (goto-char (point-min))
- (insert header)
- (insert "Content-Type: application/pgp; format=mime\n")
- (insert mail-header-separator)
- (insert "\n")
- (if (null (call-interactively command))
- (throw 'mime-editor/error 'pgp-error)
- )
- ))
-
-(defun mime-editor/pgp-processing ()
- (let ((command
- (cdr (assq mime-editor/pgp-processing
- '((sign . mc-sign)
- (encrypt . mc-encrypt)
- )))))
- (and command
- (mime-editor/call-mc command)
- )))
+(defun mime-editor/pgp-enclose-buffer ()
+ (let ((beg (save-excursion
+ (goto-char (point-min))
+ (if (search-forward (concat "\n" mail-header-separator "\n"))
+ (match-end 0)
+ )))
+ (end (point-max))
+ )
+ (if beg
+ (cond ((eq mime-editor/pgp-processing 'sign)
+ (mime-editor/enclose-signed-region beg end)
+ )
+ ((eq mime-editor/pgp-processing 'encrypt)
+ (mime-editor/enclose-encrypted-region beg end)
+ ))
+ )))
;;; @ split