]> git.eshelyaron.com Git - emacs.git/commitdiff
(c-a-p-f-with-frecency-sorting): Respect existing :exit-function
authorEshel Yaron <me@eshelyaron.com>
Wed, 11 Jun 2025 20:14:39 +0000 (22:14 +0200)
committerEshel Yaron <me@eshelyaron.com>
Wed, 11 Jun 2025 20:14:39 +0000 (22:14 +0200)
lisp/minibuffer.el

index 915c930a9dd1068f1bb1f6043f18fe49c8840fea..be3cfd3dcb5133b6748803af7127c88a0ee4abbc 100644 (file)
@@ -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.