summaryrefslogtreecommitdiff
path: root/orderless.el
diff options
context:
space:
mode:
authorOmar Antolín <omar.antolin@gmail.com>2021-01-26 18:02:56 -0600
committerOmar Antolín <omar.antolin@gmail.com>2021-01-26 18:02:56 -0600
commitc023ee1cbe2185ab984981d662ad63ce1c905ddb (patch)
tree300150b53ae1e0812ae79ca07ca86444792dc434 /orderless.el
parentee5e8bda2551d8297f5737cb866a6490be27cb9f (diff)
Add option to skip-highlighting as requested by @clemera
Diffstat (limited to 'orderless.el')
-rw-r--r--orderless.el17
1 files changed, 15 insertions, 2 deletions
diff --git a/orderless.el b/orderless.el
index 0548e2c..4e6bcd1 100644
--- a/orderless.el
+++ b/orderless.el
@@ -106,6 +106,13 @@ or a function of a single string argument."
"Vector of faces used (cyclically) for component matches."
:type '(vector face))
+(defcustom orderless-skip-highlighting nil
+ "Skip highlighting the matching parts of candidates?
+If this is set to a function, the function is called to decide
+whether to skip higlighting the matches. Any non-function non-nil
+value means highlighting is skipped."
+ :type '(choice boolean function))
+
(defcustom orderless-matching-styles
'(orderless-regexp orderless-initialism)
"List of component matching styles.
@@ -425,9 +432,15 @@ This function is part of the `orderless' completion style."
(let ((completions (orderless-filter string table pred)))
(when completions
(pcase-let ((`(,prefix . ,pattern)
- (orderless--prefix+pattern string table pred)))
+ (orderless--prefix+pattern string table pred))
+ (skip-highlighting
+ (if (functionp orderless-skip-highlighting)
+ (orderless-skip-highlighting)
+ orderless-skip-highlighting)))
(nconc
- (orderless-highlight-matches pattern completions)
+ (if skip-highlighting
+ completions
+ (orderless-highlight-matches pattern completions))
(length prefix))))))
;;;###autoload