diff options
author | Case Duckworth | 2021-04-26 15:24:31 -0500 |
---|---|---|
committer | Case Duckworth | 2021-04-26 15:24:31 -0500 |
commit | dcc7d643e2b8cbe05bb97a0185f8ea16ebdf8c03 (patch) | |
tree | 240b7113ee252100c975299b6cde231c2d2177e0 | |
parent | Fix dired-open (diff) | |
download | emacs-dcc7d643e2b8cbe05bb97a0185f8ea16ebdf8c03.tar.gz emacs-dcc7d643e2b8cbe05bb97a0185f8ea16ebdf8c03.zip |
Enhance `refresh-emacs'
- Enable `debug-on-error' - Save all init files before sourcing them
-rw-r--r-- | lisp/acdw.el | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index f1c1a8d..9426117 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -57,19 +57,26 @@ each hook in HOOKS." | |||
57 | (defun refresh-emacs () | 57 | (defun refresh-emacs () |
58 | "Reload Emacs's configuration files." | 58 | "Reload Emacs's configuration files." |
59 | (interactive) | 59 | (interactive) |
60 | (dolist (file (append | 60 | (let ((init-files (append |
61 | ;; Load lisp libraries first, in case their functionality is | 61 | ;; Load lisp libraries first, in case their functionality |
62 | ;; used by {early-,}init.el | 62 | ;; is used by {early-,}init.el |
63 | (let* ((dir (expand-file-name "lisp/" user-emacs-directory)) | 63 | (let* ((dir (expand-file-name "lisp/" |
64 | (full-name (lambda (f) | 64 | user-emacs-directory)) |
65 | (concat (file-name-as-directory dir) f)))) | 65 | (full-name (lambda (f) |
66 | (mapcar full-name (directory-files dir nil "\\.el\\'"))) | 66 | (concat |
67 | ;; Load regular init files | 67 | (file-name-as-directory dir) f)))) |
68 | (list (locate-user-emacs-file "early-init.el") | 68 | (mapcar full-name (directory-files dir nil "\\.el\\'"))) |
69 | (locate-user-emacs-file "init.el" ".emacs")))) | 69 | ;; Load regular init files |
70 | (with-message (format "Loading %s" file) | 70 | (list (locate-user-emacs-file "early-init.el") |
71 | (when (file-exists-p file) | 71 | (locate-user-emacs-file "init.el" ".emacs")))) |
72 | (load-file file))))) | 72 | (debug-on-error t)) |
73 | (with-message "Saving init files" | ||
74 | (save-some-buffers :no-confirm (lambda () (member (buffer-file-name) | ||
75 | init-files)))) | ||
76 | (dolist (file init-files) | ||
77 | (with-message (format "Loading %s" file) | ||
78 | (when (file-exists-p file) | ||
79 | (load-file file)))))) | ||
73 | 80 | ||
74 | (defun expand-file-name-exists-p (&rest expand-file-name-args) | 81 | (defun expand-file-name-exists-p (&rest expand-file-name-args) |
75 | "Call `expand-file-name' on EXPAND-FILE-NAME-ARGS, returning | 82 | "Call `expand-file-name' on EXPAND-FILE-NAME-ARGS, returning |