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
1 changed files with 14 additions and 6 deletions

View File

@ -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