diff --git a/README.org b/README.org index a514da4..30e708c 100644 --- a/README.org +++ b/README.org @@ -3230,23 +3230,31 @@ and names in buffers for debugging. :CUSTOM_ID: sec:flash-line-around-point :END: -#+caption[Implement =my-pulse-one-line=]: -#+caption: Implement =my-pulse-one-line=. -#+name: lst:my-pulse-one-line +Listing [[lst:flash-line-around-point]] implements flashing of the line around point +for visual feedback after a selection of commands that make it hard to track +point movements visually. + +#+caption[Implement =flash-line-around-point=]: +#+caption: Implement =flash-line-around-point=. +#+name: lst:flash-line-around-point #+begin_src emacs-lisp + ;; 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://www.reddit.com/r/emacs/comments/jwhr6g/batteries_included_with_emacs/ - (defun my-pulse-one-line (&rest _) - "Pulse the current line." + (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 #'my-pulse-one-line))) + (advice-add command :after #'flash-line-around-point))) #+end_src * Applications