Document flash-line-around-point after renaming

This commit is contained in:
Gerard Vermeulen 2022-04-10 07:23:29 +02:00
parent 73194427d4
commit e95ad174f0

View File

@ -3230,23 +3230,31 @@ and names in buffers for debugging.
:CUSTOM_ID: sec:flash-line-around-point :CUSTOM_ID: sec:flash-line-around-point
:END: :END:
#+caption[Implement =my-pulse-one-line=]: Listing [[lst:flash-line-around-point]] implements flashing of the line around point
#+caption: Implement =my-pulse-one-line=. for visual feedback after a selection of commands that make it hard to track
#+name: lst:my-pulse-one-line 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 #+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) (when (require 'pulse nil 'noerror)
;; https://karthinks.com/software/batteries-included-with-emacs/ ;; https://karthinks.com/software/batteries-included-with-emacs/
;; https://www.reddit.com/r/emacs/comments/jwhr6g/batteries_included_with_emacs/ ;; https://www.reddit.com/r/emacs/comments/jwhr6g/batteries_included_with_emacs/
(defun my-pulse-one-line (&rest _) (defun flash-line-around-point (&rest _)
"Pulse the current line." "Flash the line around point."
(let ((pulse-iterations 16) (let ((pulse-iterations 16)
(pulse-delay 0.1)) (pulse-delay 0.1))
(pulse-momentary-highlight-one-line (point)))) (pulse-momentary-highlight-one-line (point))))
(dolist (command '(scroll-up-command (dolist (command '(scroll-up-command
scroll-down-command scroll-down-command
recenter-top-bottom recenter-top-bottom
other-window)) other-window))
(advice-add command :after #'my-pulse-one-line))) (advice-add command :after #'flash-line-around-point)))
#+end_src #+end_src
* Applications * Applications