summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2021-04-21 17:54:29 -0500
committerCase Duckworth2021-04-21 17:54:29 -0500
commit152daf82ef2bdfe8d7a863d4d87fec02cb5a7465 (patch)
treed86826d3f9e031962efbe0eb402c2d8ab71c11bb
parentSetup emoji fonts! (diff)
downloademacs-152daf82ef2bdfe8d7a863d4d87fec02cb5a7465.tar.gz
emacs-152daf82ef2bdfe8d7a863d4d87fec02cb5a7465.zip
Add macro `with-message'
-rw-r--r--init.el12
-rw-r--r--lisp/acdw.el9
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