From cbfab437b147df53581cdfa3f3d71f62f95be33b Mon Sep 17 00:00:00 2001 From: Gerard Vermeulen Date: Wed, 12 Jun 2024 16:43:12 +0200 Subject: [PATCH] Simplify "lst:flash-line-around-point" --- README.org | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/README.org b/README.org index 24f4c24..3eb2ca4 100644 --- a/README.org +++ b/README.org @@ -5968,23 +5968,19 @@ point movements visually. #+caption: Implement =flash-line-around-point=. #+name: lst:flash-line-around-point #+begin_src emacs-lisp -n :results silent -;; Ensure loading `pulse' with the dynamic variables `pulse-delay' and -;; `pulse-iterations' before masking them lexically instead of after -;; to prevent the warning triggered by lazy loading. -(when (require 'pulse nil 'noerror) - ;; https://karthinks.com/software/batteries-included-with-emacs/ - ;; https://github.com/karthink/.emacs.d/blob/master/init.el#L2077 - (defun flash-line-around-point (&rest _) - "Flash the line around point." - (let ((pulse-iterations 16) - (pulse-delay 0.1)) - (pulse-momentary-highlight-one-line (point)))) +;; https://karthinks.com/software/batteries-included-with-emacs/ +;; https://github.com/karthink/.emacs.d/blob/master/init.el#L2077 +(defun flash-line-around-point (&rest _) + "Flash the line around point." + (let ((pulse-iterations 16) + (pulse-delay 0.1)) + (pulse-momentary-highlight-one-line (point)))) - (dolist (command '(scroll-up-command - scroll-down-command - recenter-top-bottom - other-window)) - (advice-add command :after #'flash-line-around-point))) +(dolist (command '(scroll-up-command + scroll-down-command + recenter-top-bottom + other-window)) + (advice-add command :after #'flash-line-around-point)) #+end_src * Applications