Closed eeriemyxi closed 2 days ago
Check the documentation here https://github.com/protesilaos/pulsar/blob/e23199512258f6d06b23f66bf000c85568c07a26/README.org?plain=1#L249
You probably should add those commands into the pulsar-pulse-functions list.
e.g.,
;; override the entire list
(setq pulsar-pulse-functions
'(evil-scroll-page-down
;; etc etc
recenter-top-bottom
move-to-window-line-top-bottom
reposition-window
bookmark-jump consult-bookmark
other-window my/window-other-mru ace-window
tab-new tab-close tab-next tab-previous
delete-window delete-other-windows
forward-page backward-page
scroll-up-command scroll-down-command
next-buffer previous-buffer switch-to-buffer
windmove-right windmove-left windmove-up windmove-down
windmove-swap-states-right windmove-swap-states-left windmove-swap-states-up windmove-swap-states-down))
;; add your entries to the existing list
(add-to-list 'pulsar-pulse-functions #'evil-scroll-page-down)
(use-package pulsar
:ensure t
:config
(pulsar-global-mode 1)
(add-to-list 'pulsar-pulse-functions #'evil-scroll-page-up)
(add-to-list 'pulsar-pulse-functions #'evil-scroll-page-down)
(add-to-list 'pulsar-pulse-functions #'evil-scroll-up)
(add-to-list 'pulsar-pulse-functions #'evil-scroll-down))
I tried doing what you suggested however I didn't notice any change. What worked in the end was this:
(defhydra hydra-paging nil
"paging"
("N" (lambda () (interactive) (evil-scroll-page-down 1) (pulsar-pulse-line)) "scroll down")
("E" (lambda () (interactive) (evil-scroll-page-up 1) (pulsar-pulse-line)) "scroll up")
("n" (lambda () (interactive) (evil-scroll-down (/ (window-body-height) 2)) (pulsar-pulse-line)) "scroll half down")
("e" (lambda () (interactive) (evil-scroll-up (/ (window-body-height) 2)) (pulsar-pulse-line)) "scroll half up")
("SPC" nil "quit"))
(FYI: even if I remove (pulsar-pulse-line)
from that snippet it doesn't highlight it, I had to be explicit)
If you consider it a bug, you might like to see how Hydra handles it all behind the scenes: https://github.com/abo-abo/hydra?tab=readme-ov-file#awesome-map-and-awesome-binding
From: myxi @.***> Date: Wed, 20 Nov 2024 23:09:20 -0800
[... 21 lines elided]
(FYI: even if I remove
(pulsar-pulse-line)
from that snippet it doesn't highlight it, I had to be explicit) If you consider it a bug, you might like to see how Hydra handles it all behind the scenes: https://github.com/abo-abo/hydra?tab=readme-ov-file#awesome-map-and-awesome-binding
I am not familiar with the internals of Hydra and could not make much of those docs.
To me, this looks like a case of hydra superseding the 'this-command' variable. This happens with every wrapper command. For example, this is what I have in my configuration:
(defun prot-simple-multi-line-above ()
"Move half a screen above."
(interactive)
(forward-line (- (floor (window-height) 2)))
(setq this-command 'scroll-down-command))
Notice the final 'setq'. Without that, I need to explicitly add my command's symbol to the 'pulsar-pulse-functions'. But with this 'setq' my command declares itself as 'scroll-down-command', which is already handled by Pulsar.
Maybe you can do the same with Hydra? Adding an explicit 'pulsar-pulse-line' will technically work, but is not how we normally do things.
-- Protesilaos Stavrou https://protesilaos.com
Hi, I installed this plugin,
And it indeed does work when I use
M-x evil-scroll-up
or similar commands. However for ease of use I have this convenient little Hydra definition:Unfortunately when I activate the hydra and use the keybinds Pulsar does not highlight the line like it is expected to from direct execution using
M-x
of the same commands. I am new to Emacs so I could very well be missing something important here but how do I fix this?