diff options
author | Case Duckworth | 2021-04-28 15:28:00 -0500 |
---|---|---|
committer | Case Duckworth | 2021-04-28 15:28:00 -0500 |
commit | 7514b598cfbce6f8bc872bd49a7c4ca19d207259 (patch) | |
tree | 52aa863ac416dd5f7bcb24d6b948244fb03c85fc | |
parent | Don't worry about a ~/.newsrc file (diff) | |
download | emacs-7514b598cfbce6f8bc872bd49a7c4ca19d207259.tar.gz emacs-7514b598cfbce6f8bc872bd49a7c4ca19d207259.zip |
Advise `eval-region' to pulse
Just like SLIME. I also rewrote acdw/eval-region-or-buffer a bit.
-rw-r--r-- | init.el | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/init.el b/init.el index a064bda..3d47b44 100644 --- a/init.el +++ b/init.el | |||
@@ -877,9 +877,10 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
877 | (defun acdw/eval-region-or-buffer () | 877 | (defun acdw/eval-region-or-buffer () |
878 | (interactive) | 878 | (interactive) |
879 | (if (region-active-p) | 879 | (if (region-active-p) |
880 | (with-message (format "Evaluating %S -> %S" | 880 | (let ((begin (region-beginning)) |
881 | (region-beginning) (region-end)) | 881 | (end (region-end))) |
882 | (eval-region (region-beginning) (region-end))) | 882 | (with-message (format "Evaluating %S -> %S" begin end) |
883 | (eval-region begin end))) | ||
883 | (with-message "Evaluating buffer" | 884 | (with-message "Evaluating buffer" |
884 | (eval-buffer)))) | 885 | (eval-buffer)))) |
885 | 886 | ||
@@ -896,7 +897,14 @@ if ripgrep is installed, otherwise `consult-grep'." | |||
896 | (define-key emacs-lisp-mode-map (kbd "C-c e") #'macrostep-expand)) | 897 | (define-key emacs-lisp-mode-map (kbd "C-c e") #'macrostep-expand)) |
897 | 898 | ||
898 | (setup (:straight eros) | 899 | (setup (:straight eros) |
899 | (:hook-into emacs-lisp-mode))) | 900 | (:hook-into emacs-lisp-mode)) |
901 | |||
902 | ;; Add advice to pulse evaluated regions | ||
903 | (defun acdw/elisp-eval-region-advice (fn start end &rest args) | ||
904 | (pulse-momentary-highlight-region start end) | ||
905 | (apply fn start end args)) | ||
906 | |||
907 | (advice-add 'eval-region :around #'acdw/elisp-eval-region-advice)) | ||
900 | 908 | ||
901 | (setup (:straight geiser)) | 909 | (setup (:straight geiser)) |
902 | 910 | ||