branch: elpa/anzu
commit b3b912013d745625e0c31a72db96355e20ee13a5
Author: Syohei YOSHIDA <[email protected]>
Commit: Syohei YOSHIDA <[email protected]>
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 "")))