]> git.eshelyaron.com Git - emacs.git/commitdiff
(calc-mode-var-list-restore-saved-values): Make sure settings file
authorJay Belanger <jay.p.belanger@gmail.com>
Mon, 10 Jan 2005 04:07:04 +0000 (04:07 +0000)
committerJay Belanger <jay.p.belanger@gmail.com>
Mon, 10 Jan 2005 04:07:04 +0000 (04:07 +0000)
exists before accessing it.

lisp/calc/calc.el

index eac19b9ca949debf215008ea8c033edd75a64219..a578a8666b8d2818011d6a19a5462ec9936bffe3 100644 (file)
@@ -257,15 +257,17 @@ scientific notation in calc-mode.")
 (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))