From f475fff6c5acd944815348111c1292d1e11a15a6 Mon Sep 17 00:00:00 2001 From: tomo Date: Sun, 16 Jan 2000 10:14:12 +0000 Subject: [PATCH] (mime-view-find-every-situations): Renamed from `mime-view-find-every-acting-situation'; changed to variable. (mime-situation-examples-file): Renamed from `mime-acting-situation-examples-file'. (mime-preview-situation-example-list-max-size): New variable. (mime-save-situation-examples): Renamed from `mime-save-acting-situation-examples'; save `mime-preview-situation-example-list' if it is not null. --- mime-view.el | 66 ++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/mime-view.el b/mime-view.el index a89a14b..f531d9c 100644 --- a/mime-view.el +++ b/mime-view.el @@ -52,13 +52,11 @@ "MIME view mode" :group 'mime) -(defcustom mime-view-find-every-acting-situation t - "*Find every available acting-situation if non-nil." - :group 'mime-view - :type 'boolean) +(defvar mime-view-find-every-situations t + "*Find every available situations if non-nil.") -(defcustom mime-acting-situation-examples-file "~/.mime-example" - "*File name of example about acting-situation demonstrated by user." +(defcustom mime-situation-examples-file "~/.mime-example" + "*File name of situation-examples demonstrated by user." :group 'mime-view :type 'file) @@ -297,7 +295,7 @@ mother-buffer." (setq ret (mime-delq-null-situation (ctree-find-calist condition entity-situation - mime-view-find-every-acting-situation) + mime-view-find-every-situations) 'method ignored-method)) (or (assq 'ignore-examples entity-situation) (if (cdr ret) @@ -364,30 +362,38 @@ mother-buffer." (defvar mime-preview-situation-example-list nil) (defvar mime-acting-situation-example-list nil) +(defvar mime-preview-situation-example-list-max-size 16) (defvar mime-acting-situation-example-list-max-size 16) -(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 "\n\n") - (insert ";;; Code:\n\n") - (pp `(setq mime-acting-situation-example-list - ',mime-acting-situation-example-list) - (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) +(defun mime-save-situation-examples () + (if (or mime-preview-situation-example-list + mime-acting-situation-example-list) + (let* ((file mime-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 "\n\n") + (insert ";;; Code:\n\n") + (if mime-preview-situation-example-list + (pp `(setq mime-preview-situation-example-list + ',mime-preview-situation-example-list) + (current-buffer))) + (if mime-acting-situation-example-list + (pp `(setq mime-acting-situation-example-list + ',mime-acting-situation-example-list) + (current-buffer))) + (insert "\n;;; " + (file-name-nondirectory file) + " ends here.\n") + (save-buffer)) + (kill-buffer buffer))))) + +(add-hook 'kill-emacs-hook 'mime-save-situation-examples) (defun mime-reduce-acting-situation-examples () (let ((len (length mime-acting-situation-example-list)) @@ -1701,7 +1707,7 @@ It calls function registered in variable (provide 'mime-view) -(let* ((file mime-acting-situation-examples-file) +(let* ((file mime-situation-examples-file) (buffer (get-buffer-create " *mime-example*"))) (if (file-readable-p file) (unwind-protect -- 1.7.10.4