mime-view.el (mime-save-situation-examples): Don't fail when semi-1_14-wl-root
authorvitaly <vitaly>
Sun, 24 Oct 2010 10:39:22 +0000 (10:39 +0000)
committervitaly <vitaly>
Sun, 24 Oct 2010 10:39:22 +0000 (10:39 +0000)
mime-situation-examples-file is nil.

ChangeLog
mime-view.el

index 1beb192..c62fc57 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-10-24  Vitaly Mayatskikh  <v.mayatskih@gmail.com>
+
+       * mime-view.el (mime-save-situation-examples): Don't fail when
+       mime-situation-examples-file is nil.
+
 2010-06-21  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * SEMI-CFG: Add emu subdirectory to load-path when LISPDIR is
index 89a760c..66c8a7b 100644 (file)
@@ -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)