From 940ba05e6ab3ad47c0b010c48d7d0da250da004b Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 20 Mar 2018 03:40:18 -0400 Subject: [PATCH] Fix miscounting in anzu (search) modeline segment --- modules/ui/doom-modeline/config.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/ui/doom-modeline/config.el b/modules/ui/doom-modeline/config.el index 01e244082..ec029ad36 100644 --- a/modules/ui/doom-modeline/config.el +++ b/modules/ui/doom-modeline/config.el @@ -11,6 +11,15 @@ (setq anzu-cons-mode-line-p nil anzu-minimum-input-length 1 anzu-search-threshold 250) + + (defun +doom-modeline*fix-anzu-count (positions here) + (cl-loop for (start . end) in positions + collect t into before + when (and (>= here start) (<= here end)) + return (length before) + finally return 0)) + (advice-add #'anzu--where-is-here :override #'+doom-modeline*fix-anzu-count) + ;; Avoid anzu conflicts across buffers (mapc #'make-variable-buffer-local '(anzu--total-matched anzu--current-position anzu--state