From dba3ae5e4d9a17c5b18bdf4cd2a02708585bb7cb Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 18 May 2019 18:16:16 -0400 Subject: [PATCH] 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. --- modules/ui/nav-flash/autoload.el | 8 ++++++-- modules/ui/nav-flash/config.el | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/modules/ui/nav-flash/autoload.el b/modules/ui/nav-flash/autoload.el index 1e8f2a03d..c7d5f46d6 100644 --- a/modules/ui/nav-flash/autoload.el +++ b/modules/ui/nav-flash/autoload.el @@ -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 _) diff --git a/modules/ui/nav-flash/config.el b/modules/ui/nav-flash/config.el index 7aa48b908..0720c6d94 100644 --- a/modules/ui/nav-flash/config.el +++ b/modules/ui/nav-flash/config.el @@ -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)