summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-07-11 22:02:41 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2024-07-11 22:02:41 +0200
commit178b0c55f2cb49f27cd972f731ea45e5d3aea262 (patch)
treef02f6407fbf9aafcef589edb4c33074aa168f4de
parent4040f67949eab1cfca5bb52dca816f8f65955853 (diff)
orderless-annotation: Match against both prefix and suffix (Fix #176)
-rw-r--r--orderless.el21
1 files changed, 10 insertions, 11 deletions
diff --git a/orderless.el b/orderless.el
index e4ea85a..e29849b 100644
--- a/orderless.el
+++ b/orderless.el
@@ -306,18 +306,17 @@ which can invert any predicate or regexp."
(defun orderless-annotation (pred regexp)
"Match candidates where the annotation matches PRED and REGEXP."
- (when-let ((metadata (orderless--metadata))
- (fun (or (completion-metadata-get
- metadata 'annotation-function)
+ (let ((md (orderless--metadata)))
+ (if-let ((fun (or (completion-metadata-get md 'affixation-function)
(plist-get completion-extra-properties
- :annotation-function)
- (when-let ((aff (or (completion-metadata-get
- metadata 'affixation-function)
- (plist-get completion-extra-properties
- :affixation-function))))
- (lambda (cand) (caddar (funcall aff (list cand))))))))
- (lambda (str)
- (orderless--match-p pred regexp (funcall fun str)))))
+ :affixation-function))))
+ (lambda (str)
+ (cl-loop for s in (cdar (funcall fun (list str)))
+ thereis (orderless--match-p pred regexp s)))
+ (when-let ((fun (or (completion-metadata-get md 'annotation-function)
+ (plist-get completion-extra-properties
+ :annotation-function))))
+ (lambda (str) (orderless--match-p pred regexp (funcall fun str)))))))
;;; Highlighting matches