Skip to content

Commit

Permalink
Don't crash Emacs if local-config doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
strugee committed Jun 16, 2022
1 parent 3a01334 commit 1b0c821
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .emacs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@

(defun local-config-val-p (val)
"See if VAL is present in the local-config file."
(member (concat "emacs-" val) (with-temp-buffer
(insert-file-contents (expand-file-name "~/configs/local-config"))
(split-string (buffer-string) "\n" t))))
(member (concat "emacs-" val)
(let ((filename (expand-file-name "~/configs/local-config")))
(if (file-exists-p filename)
(with-temp-buffer (insert-file-contents filename)
(split-string (buffer-string) "\n" t))
(list)))))

;;;;;;;;;;;;;;;
;
Expand Down

0 comments on commit 1b0c821

Please sign in to comment.