From 4616d30f40c2547f6a1bad0b35c5e452ca4c413b Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Wed, 11 Jun 2025 22:14:39 +0200 Subject: [PATCH] (c-a-p-f-with-frecency-sorting): Respect existing :exit-function --- lisp/minibuffer.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index 915c930a9dd..be3cfd3dcb5 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -3393,6 +3393,7 @@ modify CAPF." (let* ((pred (plist-get plist :predicate)) (completion-extra-properties plist) (md (completion-metadata (buffer-substring beg end) table pred)) + (ef (completion-metadata-get md 'exit-function)) (sf (completion-metadata-get md 'sort-function))) `( ,beg ,end ,(completion-table-with-metadata @@ -3409,11 +3410,12 @@ modify CAPF." ,@(plist-put (copy-sequence plist) :exit-function - (lambda (str _sts) + (lambda (str sts) (let* ((str (substring-no-properties str)) (ts (gethash str cache))) (setf (gethash str cache) - (cons (float-time) (1+ (or (cdr ts) 0)))))))))))))) + (cons (float-time) (1+ (or (cdr ts) 0))))) + (when (functionp ef) (funcall ef str sts))))))))))) (defun completion-at-point () "Perform completion on the text around point. -- 2.39.5