summaryrefslogtreecommitdiff
path: root/cape.el
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2024-07-17 10:13:28 +0200
committerDaniel Mendler <mail@daniel-mendler.de>2024-07-17 10:16:38 +0200
commit4fd90e3752aefe3ed38b0edc4b94214a5e64002f (patch)
treeae953f28d9ada259d332316497ff7032f8b6f961 /cape.el
parente8b5667b19ebe1a451b6c5514e023b21571995d9 (diff)
cape-wrap-super: Call metadata functions with correct candidates
Make sure to call metadata functions only with candidates belonging to the originating Capf.
Diffstat (limited to 'cape.el')
-rw-r--r--cape.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/cape.el b/cape.el
index d2bcc32..5f8d61c 100644
--- a/cape.el
+++ b/cape.el
@@ -1008,13 +1008,14 @@ multiple super Capfs in the `completion-at-point-functions':
,@(and (not exclusive) '(:exclusive no))
,@(mapcan
(lambda (prop)
- (list prop (lambda (cand &rest args)
- (let ((ref (get-text-property 0 'cape-capf-super cand)))
- (when-let ((fun (plist-get
- (or (cdr ref)
- (and cand-ht (gethash cand cand-ht)))
- prop)))
- (apply fun (or (car ref) cand) args))))))
+ (list prop
+ (lambda (cand &rest args)
+ (if-let ((ref (get-text-property 0 'cape-capf-super cand)))
+ (when-let ((fun (plist-get (cdr ref) prop)))
+ (apply fun (car ref) args))
+ (when-let ((plist (and cand-ht (gethash cand cand-ht)))
+ (fun (plist-get plist prop)))
+ (apply fun cand args))))))
cand-functions)))))
;;;###autoload