changeset 59449:00dbe02e6d46

(calc-mode-var-list-restore-saved-values): Make sure settings file exists before accessing it.
author Jay Belanger <jay.p.belanger@gmail.com>
date Mon, 10 Jan 2005 04:07:04 +0000
parents 1a855ee4f5fd
children 67b1abfb6804
files lisp/calc/calc.el
diffstat 1 files changed, 11 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calc/calc.el	Sun Jan 09 22:13:11 2005 +0000
+++ b/lisp/calc/calc.el	Mon Jan 10 04:07:04 2005 +0000
@@ -257,15 +257,17 @@
 (defun calc-mode-var-list-restore-saved-values ()
   (let ((newvarlist '()))
     (save-excursion
-      (let (pos)
-        (set-buffer (find-file-noselect (substitute-in-file-name
-                                         calc-settings-file)))
-        (goto-char (point-min))
-        (when (and (search-forward ";;; Mode settings stored by Calc" nil t)
-                   (progn
-                     (forward-line 1)
-                     (setq pos (point))
-                     (search-forward "\n;;; End of mode settings" nil t)))
+      (let (pos
+            (file (substitute-in-file-name calc-settings-file)))
+        (when (and
+               (file-regular-p file)
+               (set-buffer (find-file-noselect file))
+               (goto-char (point-min))
+               (search-forward ";;; Mode settings stored by Calc" nil t)
+               (progn
+                 (forward-line 1)
+                 (setq pos (point))
+                 (search-forward "\n;;; End of mode settings" nil t)))
           (beginning-of-line)
           (calc-mode-var-list-restore-default-values)
           (eval-region pos (point))