emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/anzu 06f4cf2fe7 037/288: Introduce anzu-minimum-input-leng


From: ELPA Syncer
Subject: [nongnu] elpa/anzu 06f4cf2fe7 037/288: Introduce anzu-minimum-input-length
Date: Thu, 6 Jan 2022 03:58:37 -0500 (EST)

branch: elpa/anzu
commit 06f4cf2fe739352975ee0a77f05ed9052de456b3
Author: Syohei YOSHIDA <syohex@gmail.com>
Commit: Syohei YOSHIDA <syohex@gmail.com>

    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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]