tm 7.70.
[elisp/tm.git] / tm-edit.el
index 86cc55a..8e7334f 100644 (file)
@@ -8,7 +8,7 @@
 ;;;         MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;;; Maintainer: MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;;; Created: 1994/08/21 renamed from mime.el
-;;; Version: $Revision: 7.69 $
+;;; Version: $Revision: 7.70 $
 ;;; 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.69 1996/06/27 14:22:59 morioka Exp $")
+  "$Id: tm-edit.el,v 7.70 1996/07/09 13:30:32 morioka Exp $")
 
 (defconst mime-editor/version (get-version-string mime-editor/RCS-ID))
 
@@ -501,6 +501,8 @@ Tspecials means any character that matches with it in header must be quoted.")
 (defconst mime-editor/mime-map (make-sparse-keymap)
   "Keymap for MIME commands.")
 
+(defconst mime-editor/minor-mime-map nil
+  "Keymap for MIME commands.")
 
 ;;; @ keymap and menu
 ;;;
@@ -508,10 +510,6 @@ Tspecials means any character that matches with it in header must be quoted.")
 (defvar mime/editor-mode-flag nil)
 (make-variable-buffer-local 'mime/editor-mode-flag)
 
-(set-alist 'minor-mode-alist
-          'mime/editor-mode-flag
-          '((" MIME-Edit "  mime-editor/transfer-level-string)))
-
 (defun mime-editor/define-keymap (keymap)
   "Add mime-editor commands to KEYMAP."
   (if (not (keymapp keymap))
@@ -539,6 +537,29 @@ Tspecials means any character that matches with it in header must be quoted.")
 
 (mime-editor/define-keymap mime-editor/mime-map)
 
+(if mime-editor/minor-mime-map
+    ()
+  (setq mime-editor/minor-mime-map 
+       (make-sparse-keymap 'mime-editor/minor-mime-map))
+  (define-key mime-editor/minor-mime-map mime-prefix mime-editor/mime-map))
+
+(defun mime-editor/toggle-mode ()
+  (interactive)
+  (if mime/editor-mode-flag
+      (mime-editor/exit 'nomime)
+    (mime/editor-mode)
+    ))
+
+(if running-xemacs
+    (add-minor-mode 'mime/editor-mode-flag
+                   '((" MIME-Edit "  mime-editor/transfer-level-string))
+                   mime-editor/minor-mime-map
+                   nil
+                   'mime-editor/toggle-mode)
+  (set-alist 'minor-mode-alist
+            'mime/editor-mode-flag
+            '((" MIME-Edit "  mime-editor/transfer-level-string))))
+
 (defconst mime-editor/menu-title "MIME-Edit")
 
 (defconst mime-editor/menu-list
@@ -791,10 +812,6 @@ just return to previous mode."
     ;; Restore previous state.
     (setq mime/editor-mode-flag nil)
     (cond (running-xemacs
-          ;; mime-prefix only defined if binding was nil
-          (if (eq (lookup-key (current-local-map) mime-prefix)
-                  mime-editor/mime-map)
-              (define-key (current-local-map) mime-prefix nil))
           (delete-menu-item (list mime-editor/menu-title)))
          (t
           (use-local-map mime/editor-mode-old-local-map)))