(mime-save-acting-situation-examples): New function; set up for
authormorioka <morioka>
Wed, 29 Apr 1998 16:30:47 +0000 (16:30 +0000)
committermorioka <morioka>
Wed, 29 Apr 1998 16:30:47 +0000 (16:30 +0000)
'kill-emacs-hook.

mime-play.el

index 63e3488..f5d1499 100644 (file)
 
 (eval-when-compile (require 'mime-text))
 
+
+(defvar mime-acting-situation-examples nil)
+
+(defun mime-save-acting-situation-examples ()
+  (let* ((file mime-acting-situation-examples-file)
+        (buffer (get-buffer-create " *mime-example*")))
+    (unwind-protect
+        (save-excursion
+          (set-buffer buffer)
+          (setq buffer-file-name file)
+          (erase-buffer)
+          (insert ";;; " (file-name-nondirectory file) "\n")
+          (insert "\n;; This file is generated automatically by "
+                  mime-view-version-string "\n\n")
+         (insert ";;; Code:\n\n")
+         (pp `(setq mime-acting-situation-examples
+                    ',mime-acting-situation-examples)
+             (current-buffer))
+         (insert "\n;;; "
+                  (file-name-nondirectory file)
+                  " ends here.\n")
+          (save-buffer))
+      (kill-buffer buffer))))
+
+(add-hook 'kill-emacs-hook 'mime-save-acting-situation-examples)
+
   
 ;;; @ content decoder
 ;;;
@@ -58,8 +84,6 @@ If MODE is specified, play as it.  Default MODE is \"play\"."
            (goto-char mime-preview-after-decoded-position)
            )))))
 
-(defvar mime-acting-situation-examples nil)
-
 (defun mime-raw-play-entity (entity-info &optional mode)
   "Play entity specified by ENTITY-INFO.
 It decodes the entity to call internal or external method.  The method