branch: elpa/anzu
commit 06f4cf2fe739352975ee0a77f05ed9052de456b3
Author: Syohei YOSHIDA <[email protected]>
Commit: Syohei YOSHIDA <[email protected]>
Introduce anzu-minimum-input-length
---
anzu.el | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/anzu.el b/anzu.el
index 8363b0d428..b69eebc20f 100644
--- a/anzu.el
+++ b/anzu.el
@@ -53,6 +53,11 @@
:type 'boolean
:group 'anzu)
+(defcustom anzu-minimum-input-length 1
+ "Minimum input length to enable anzu"
+ :type 'integer
+ :group 'anzu)
+
(defcustom anzu-use-migemo nil
"Flag of using migemo"
:type 'boolean
@@ -121,16 +126,16 @@
finally return 0))
(defun anzu--update ()
- (unless (string= isearch-string "")
+ (when (>= (length isearch-string) anzu-minimum-input-length)
(let ((result (if (string= isearch-string anzu--last-isearch-string)
anzu--cached-positions
(anzu--search-all-position isearch-string))))
(let ((total (car result))
(positions (cdr result)))
- (setq anzu--total-matched total
- anzu--current-posion (anzu--where-is-here positions (point))
- anzu--last-isearch-string isearch-string)
- (force-mode-line-update)))))
+ (setq anzu--total-matched total
+ anzu--current-posion (anzu--where-is-here positions (point))
+ anzu--last-isearch-string isearch-string)
+ (force-mode-line-update)))))
(defsubst anzu--mode-line-not-set-p ()
(and (listp mode-line-format)