nav-flash: better mechanism on determining last point before blink

This is ported from Doom Emacs.
This commit is contained in:
Lucius Hu 2022-07-26 02:53:40 -04:00
parent fdfd9f1457
commit 8e3686d254
No known key found for this signature in database
GPG Key ID: 7E474E82E29B5A7A
2 changed files with 7 additions and 5 deletions

View File

@ -1,4 +1,4 @@
;; config.el --- Nav-flash Layer Configuration File for Spacemacs.
;;; config.el --- Nav-flash Layer Configuration File for Spacemacs. -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2012-2022 Sylvain Benner & Contributors
;;
@ -32,4 +32,4 @@
'(repeat symbol))
(defvar nav-flash--last-point nil
"Internal variable to store the last point and windoow before blinking.")
"Internal variable to store the active window, buffer, point before blinking.")

View File

@ -38,10 +38,12 @@ like switching windows or jumping to another part of the file)."
(unless (or (memq this-command nav-flash-exclude-commands)
(bound-and-true-p so-long-minor-mode)
(apply #'derived-mode-p nav-flash-exclude-modes)
(and (equal (point-marker) (car nav-flash--last-point))
(equal (selected-window) (cdr nav-flash--last-point))))
(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)))))
(defun nav-flash/delayed-blink-cursor-h (&rest _)
"Like `nav-flash//blink-cursor', but blinks after a tiny pause.