diff options
-rw-r--r-- | init.el | 12 | ||||
-rw-r--r-- | lisp/acdw.el | 9 |
2 files changed, 14 insertions, 7 deletions
diff --git a/init.el b/init.el index b8523e2..d2a8960 100644 --- a/init.el +++ b/init.el | |||
@@ -846,13 +846,11 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
846 | (defun acdw/eval-region-or-buffer () | 846 | (defun acdw/eval-region-or-buffer () |
847 | (interactive) | 847 | (interactive) |
848 | (if (region-active-p) | 848 | (if (region-active-p) |
849 | (progn | 849 | (with-message (format "Evaluating %S -> %S" |
850 | (message "Evaluating %S -> %S..." (region-beginning) (region-end)) | 850 | (region-beginning) (region-end)) |
851 | (eval-region (region-beginning) (region-end)) | 851 | (eval-region (region-beginning) (region-end))) |
852 | (message "Evaluating %S -> %S... Done." (region-beginning) (region-end))) | 852 | (with-message "Evaluating buffer" |
853 | (message "%s" "Evaluating buffer...") | 853 | (eval-buffer)))) |
854 | (eval-buffer) | ||
855 | (message "%s" "Evaluating buffer... Done."))) | ||
856 | 854 | ||
857 | (:with-map emacs-lisp-mode-map | 855 | (:with-map emacs-lisp-mode-map |
858 | (:bind "C-c C-c" acdw/eval-region-or-buffer | 856 | (:bind "C-c C-c" acdw/eval-region-or-buffer |
diff --git a/lisp/acdw.el b/lisp/acdw.el index 483bf60..1a699bb 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -70,6 +70,15 @@ each hook in HOOKS." | |||
70 | file | 70 | file |
71 | nil))) | 71 | nil))) |
72 | 72 | ||
73 | (defmacro with-message (message &rest body) | ||
74 | "Execute BODY, messaging 'MESSAGE...' before and 'MESSAGE... Done.' after." | ||
75 | (declare (indent 1)) | ||
76 | ;; Wrap a progn inside a prog1 to return the return value of the body. | ||
77 | `(prog1 | ||
78 | (progn (message "%s..." ,message) | ||
79 | ,@body) | ||
80 | (message "%s... Done." ,message))) | ||
81 | |||
73 | (defun acdw/dir (&optional file make-directory) | 82 | (defun acdw/dir (&optional file make-directory) |
74 | "Place Emacs files in one place. | 83 | "Place Emacs files in one place. |
75 | 84 | ||