From: Jay Belanger Date: Mon, 10 Jan 2005 04:07:04 +0000 (+0000) Subject: (calc-mode-var-list-restore-saved-values): Make sure settings file X-Git-Tag: ttn-vms-21-2-B4~2837 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f1ed747e1074335bbc39cc58680e67c3d4b27824;p=emacs.git (calc-mode-var-list-restore-saved-values): Make sure settings file exists before accessing it. --- diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el index eac19b9ca94..a578a8666b8 100644 --- a/lisp/calc/calc.el +++ b/lisp/calc/calc.el @@ -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))