From: vitaly Date: Sun, 24 Oct 2010 10:39:22 +0000 (+0000) Subject: mime-view.el (mime-save-situation-examples): Don't fail when X-Git-Tag: semi-1_14-wl-root X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=7a2f4ca35e6cd07f0ab9edee7e9a7346f7e8a366;p=elisp%2Fsemi.git mime-view.el (mime-save-situation-examples): Don't fail when mime-situation-examples-file is nil. --- diff --git a/ChangeLog b/ChangeLog index 1beb192..c62fc57 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2010-10-24 Vitaly Mayatskikh + + * mime-view.el (mime-save-situation-examples): Don't fail when + mime-situation-examples-file is nil. + 2010-06-21 Katsumi Yamaoka * SEMI-CFG: Add emu subdirectory to load-path when LISPDIR is diff --git a/mime-view.el b/mime-view.el index 89a760c..66c8a7b 100644 --- a/mime-view.el +++ b/mime-view.el @@ -427,33 +427,34 @@ mother-buffer." mime-acting-situation-example-list) (let ((file mime-situation-examples-file) print-length print-level) - (with-temp-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") - (static-cond - ((boundp 'buffer-file-coding-system) - (setq buffer-file-coding-system - mime-situation-examples-file-coding-system)) - ((boundp 'file-coding-system) - (setq file-coding-system - mime-situation-examples-file-coding-system))) - ;; (setq buffer-file-coding-system - ;; mime-situation-examples-file-coding-system) - (setq buffer-file-name file) - (save-buffer))))) + (when file + (with-temp-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") + (static-cond + ((boundp 'buffer-file-coding-system) + (setq buffer-file-coding-system + mime-situation-examples-file-coding-system)) + ((boundp 'file-coding-system) + (setq file-coding-system + mime-situation-examples-file-coding-system))) + ;; (setq buffer-file-coding-system + ;; mime-situation-examples-file-coding-system) + (setq buffer-file-name file) + (save-buffer)))))) (add-hook 'kill-emacs-hook 'mime-save-situation-examples)