From 82632de098a0bce3c1546566781e3bb8cfa779f6 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Tue, 6 Jan 2026 02:42:59 +0100 Subject: Move corfu-auto-trigger handling to corfu-auto.el --- corfu.el | 12 +++++------- extensions/corfu-auto.el | 4 +++- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/corfu.el b/corfu.el index b0f047e..f5c8701 100644 --- a/corfu.el +++ b/corfu.el @@ -365,12 +365,11 @@ It is recommended to avoid changing these parameters.") (unless (equal str (buffer-substring-no-properties beg end)) (completion--replace beg end str))) -(defun corfu--capf-wrapper (fun &optional prefix trigger) +(defun corfu--capf-wrapper (fun &optional prefix) "Wrapper for `completion-at-point' FUN. -The wrapper determines if the Capf is applicable at the current position -and performs sanity checking on the returned result. For non-exclusive -Capfs, the wrapper checks if the current input can be completed. PREFIX -is the minimum prefix length and TRIGGER is a list of trigger events." +The wrapper determines if the Capf is applicable at the current +position, performs sanity checking on the returned result and computes +the initial completion state. PREFIX is the minimum prefix length." (pcase (funcall fun) (`(,beg ,end ,table . ,plist) (and (integer-or-marker-p beg) ;; Valid Capf result @@ -379,8 +378,7 @@ is the minimum prefix length and TRIGGER is a list of trigger events." (or (not prefix) (let ((len (or (plist-get plist :company-prefix-length) (- (point) beg)))) - (or (eq len t) (>= len prefix) - (seq-contains-p trigger last-command-event)))) + (or (eq len t) (>= len prefix)))) (let* ((str (buffer-substring-no-properties beg end)) (pt (- (point) beg)) (pred (plist-get plist :predicate)) diff --git a/extensions/corfu-auto.el b/extensions/corfu-auto.el index 8a99e1c..2c83947 100644 --- a/extensions/corfu-auto.el +++ b/extensions/corfu-auto.el @@ -77,7 +77,9 @@ The list can contain either command symbols or regular expressions." (pcase (while-no-input ;; Interruptible Capf query (run-hook-wrapped 'completion-at-point-functions - #'corfu--capf-wrapper corfu-auto-prefix corfu-auto-trigger)) + #'corfu--capf-wrapper + (unless (seq-contains-p corfu-auto-trigger last-command-event) + corfu-auto-prefix))) (`(,fun ,beg ,end ,table . ,plist) (pcase-let* ((completion-in-region-mode-predicate (lambda () -- cgit v1.0