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

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

[nongnu] elpa/anzu b3b912013d 225/288: Add custom variable of replacemen


From: ELPA Syncer
Subject: [nongnu] elpa/anzu b3b912013d 225/288: Add custom variable of replacement threshold
Date: Thu, 6 Jan 2022 03:58:55 -0500 (EST)

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

    Add custom variable of replacement threshold
---
 anzu.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/anzu.el b/anzu.el
index f091ce4355..b55cb7c568 100644
--- a/anzu.el
+++ b/anzu.el
@@ -66,6 +66,12 @@
                  (boolean :tag "No threshold" nil))
   :group 'anzu)
 
+(defcustom anzu-replace-threshold nil
+  "Limit of replacement overlays."
+  :type '(choice (integer :tag "Threshold of replacement overlays")
+                 (boolean :tag "No threshold" nil))
+  :group 'anzu)
+
 (defcustom anzu-use-migemo nil
   "Flag of using migemo"
   :type 'boolean
@@ -555,7 +561,12 @@
   (cl-loop for ov in (overlays-in beg end)
            when (overlay-get ov 'anzu-replace)
            collect ov into anzu-overlays
-           finally return (sort anzu-overlays 'anzu--overlay-sort)))
+           finally
+           return
+           (let ((sorted (sort anzu-overlays 'anzu--overlay-sort)))
+             (if anzu-replace-threshold
+                 (cl-subseq sorted 0 (min (length sorted) 
anzu-replace-threshold))
+               sorted))))
 
 (defsubst anzu--propertize-to-string (str)
   (let ((separator (or anzu-replace-to-string-separator "")))



reply via email to

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