From e1667ef4c6f20d86cc3d3586bf7bd50033e0cce8 Mon Sep 17 00:00:00 2001 From: morioka Date: Wed, 29 Apr 1998 16:30:47 +0000 Subject: [PATCH] (mime-save-acting-situation-examples): New function; set up for 'kill-emacs-hook. --- mime-play.el | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/mime-play.el b/mime-play.el index 63e3488..f5d1499 100644 --- a/mime-play.el +++ b/mime-play.el @@ -32,6 +32,32 @@ (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 -- 1.7.10.4