From f0d601d2ac025f8e80655d26bae522bbd605211e Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 7 Mar 2021 14:30:42 -0500 Subject: [PATCH] ui/nav-flash: refactor + Avoid generating unneeded markers (relatively expensive in the long run). + Extract excluded major modes into a variable. --- modules/ui/nav-flash/autoload.el | 11 ++++++----- modules/ui/nav-flash/config.el | 4 ++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/ui/nav-flash/autoload.el b/modules/ui/nav-flash/autoload.el index 4c1bc201e..f558f6937 100644 --- a/modules/ui/nav-flash/autoload.el +++ b/modules/ui/nav-flash/autoload.el @@ -19,12 +19,13 @@ jumping to another part of the file)." vterm-mode, or triggered from one of `+nav-flash-exclude-commands'." (unless (or (memq this-command +nav-flash-exclude-commands) (bound-and-true-p so-long-minor-mode) - (derived-mode-p 'so-long-mode 'special-mode 'term-mode - 'vterm-mode) - (and (equal (point-marker) (car +nav-flash--last-point)) - (equal (selected-window) (cdr +nav-flash--last-point)))) + (apply #'derived-mode-p +nav-flash-exclude-modes) + (equal +nav-flash--last-point + (list (selected-window) + (current-buffer) + (point)))) (+nav-flash-blink-cursor) - (setq +nav-flash--last-point (cons (point-marker) (selected-window))))) + (setq +nav-flash--last-point (list (selected-window) (current-buffer) (point))))) ;;;###autoload (defun +nav-flash-delayed-blink-cursor-h (&rest _) diff --git a/modules/ui/nav-flash/config.el b/modules/ui/nav-flash/config.el index 5bfdd2747..c9722787e 100644 --- a/modules/ui/nav-flash/config.el +++ b/modules/ui/nav-flash/config.el @@ -5,6 +5,10 @@ org-find-file org-find-file-at-mouse) "A list of commands that should not trigger nav-flash.") +(defvar +nav-flash-exclude-modes + '(so-long-mode special-mode comint-mode term-mode vterm-mode) + "List of major modes where nav-flash won't automatically trigger.") + ;; ;;; Packages