about summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
authorCase Duckworth2021-04-26 15:24:31 -0500
committerCase Duckworth2021-04-26 15:24:31 -0500
commitdcc7d643e2b8cbe05bb97a0185f8ea16ebdf8c03 (patch)
tree240b7113ee252100c975299b6cde231c2d2177e0 /lisp
parentFix dired-open (diff)
downloademacs-dcc7d643e2b8cbe05bb97a0185f8ea16ebdf8c03.tar.gz
emacs-dcc7d643e2b8cbe05bb97a0185f8ea16ebdf8c03.zip
Enhance `refresh-emacs'
- Enable `debug-on-error'
- Save all init files before sourcing them
Diffstat (limited to 'lisp')
-rw-r--r--lisp/acdw.el33
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