Prevent nav-flash from firing too often

And trigger on better-jumper-post-jump-hook instead, so that non-evil
users can benefit from nav-flash in this case too.
This commit is contained in:
Henrik Lissner 2019-05-18 18:16:16 -04:00
parent 4cde9afd93
commit dba3ae5e4d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 7 additions and 3 deletions

View file

@ -1,5 +1,7 @@
;;; ui/nav-flash/autoload.el -*- lexical-binding: t; -*-
(defvar +nav-flash--last-point nil)
;;;###autoload
(defun +nav-flash-blink-cursor (&rest _)
"Blinks the current line in the current window, to make it clear where the
@ -15,8 +17,10 @@ jumping to another part of the file)."
"Like `+nav-flash-blink-cursor', but no-ops if in special-mode or term-mode,
or triggered from one of `+nav-flash-exclude-commands'."
(unless (or (derived-mode-p 'special-mode 'term-mode)
(memq this-command +nav-flash-exclude-commands))
(+nav-flash-blink-cursor)))
(memq this-command +nav-flash-exclude-commands)
(equal (point-marker) +nav-flash--last-point))
(+nav-flash-blink-cursor)
(setq +nav-flash--last-point (point-marker))))
;;;###autoload
(defun +nav-flash|delayed-blink-cursor (&rest _)

View file

@ -12,7 +12,7 @@
;; commands, which will trigger nav-flash.
(add-hook!
'(doom-switch-window-hook
imenu-after-jump-hook evil-jumps-post-jump-hook
imenu-after-jump-hook better-jumper-post-jump-hook
counsel-grep-post-action-hook dumb-jump-after-jump-hook)
#'+nav-flash|blink-cursor-maybe)