summary refs log tree commit diff stats
path: root/lisp/+pulse.el
diff options
context:
space:
mode:
authorCase Duckworth2021-12-04 23:09:33 -0600
committerCase Duckworth2021-12-04 23:09:33 -0600
commitb1d307126913cbd4d8af818f7aec7ada6a0ea4ad (patch)
treefdbedcf62596ad56d8bc1a36ea4c4d993ddc3168 /lisp/+pulse.el
parentChange defaults (diff)
downloademacs-b1d307126913cbd4d8af818f7aec7ada6a0ea4ad.tar.gz
emacs-b1d307126913cbd4d8af818f7aec7ada6a0ea4ad.zip
uhhhhhhhh
Diffstat (limited to 'lisp/+pulse.el')
-rw-r--r--lisp/+pulse.el50
1 files changed, 50 insertions, 0 deletions
diff --git a/lisp/+pulse.el b/lisp/+pulse.el new file mode 100644 index 0000000..6ba7ded --- /dev/null +++ b/lisp/+pulse.el
@@ -0,0 +1,50 @@
1;;; +pulse.el -*- lexical-binding: t; -*-
2
3;;; Code:
4
5(defgroup +pulse nil
6 "Extra customizations for `pulse'."
7 :group 'pulse
8 :prefix "+pulse-")
9
10(defcustom +pulse-location-commands '(scroll-up-command
11 scroll-down-command
12 recenter-top-bottom
13 other-window
14 switch-to-buffer
15 redraw-frame)
16 "Commands to pulse the current line after.
17Good for finding location."
18 :type '(repeat function))
19
20(defcustom +pulse-location-function '+pulse-line-current-window
21 "What function to call after `+pulse-location-commands'."
22 :type 'function)
23
24;; XXX: this doesn't work yet. I only want to pulse the line in the
25;; active window, so when I have the same buffer viewed in multiple
26;; windows I can still see where my cursor is. To see the issue, C-x
27;; 2 then C-x o a few times.
28(defun +pulse-line-current-window (&rest _)
29 "Pulse the current line, but only if this window is active."
30 (pulse-momentary-highlight-one-line
31 (window-point (selected-window))))
32
33(defun +pulse--advice-remove (symbol where function &optional props)
34 "Remove advice SYMBOL from FUNCTION.
35This uses the same args as `advice-add' for easy toggling.
36WHERE and PROPS are discarded."
37 (ignore where props)
38 (advice-remove symbol function))
39
40(define-minor-mode +pulse-location-mode
41 "After moving locations, pulse where we are."
42 :global t
43 :keymap nil
44 (dolist (command +pulse-location-commands)
45 (funcall
46 (if +pulse-location-mode 'advice-add '+pulse--advice-remove)
47 command :after +pulse-location-function)))
48
49(provide '+pulse)
50;;; +pulse.el ends here