summaryrefslogtreecommitdiff
path: root/corfu.el
diff options
context:
space:
mode:
authorDaniel Mendler <mail@daniel-mendler.de>2026-01-06 12:42:14 +0100
committerDaniel Mendler <mail@daniel-mendler.de>2026-01-06 12:42:14 +0100
commitf3717e0db8fada4e2b571bd81d6195187149506e (patch)
treed765f7fb4623faee66910d1e4f21738529d3b8c9 /corfu.el
parentc9ce729635cf2bcdb481e3c6e63ce44e471885b9 (diff)
Improve corfu--setup, drop initial state from properties
Diffstat (limited to 'corfu.el')
-rw-r--r--corfu.el13
1 files changed, 7 insertions, 6 deletions
diff --git a/corfu.el b/corfu.el
index f5c8701..a42587b 100644
--- a/corfu.el
+++ b/corfu.el
@@ -387,7 +387,7 @@ the initial completion state. PREFIX is the minimum prefix length."
`(,fun ,beg ,end ,table :corfu--state ,state ,@plist))
;; Stop with empty result for exclusive Capf.
((not (eq 'no (plist-get plist :exclusive)))
- `(ignore ,beg ,end nil))))))))
+ '(nil))))))))
(defun corfu--make-buffer (name)
"Create buffer with NAME."
@@ -901,11 +901,12 @@ Lookup STR in CANDS to restore text properties."
(defun corfu--setup (beg end table pred)
"Setup Corfu completion state.
See `completion-in-region' for the arguments BEG, END, TABLE, PRED."
- (when-let* ((state (plist-get completion-extra-properties :corfu--state)))
- (plist-put completion-extra-properties :corfu--state nil)
- (dolist (s state) (set (car s) (cdr s))))
- (setq end (if (and (markerp end) (marker-insertion-type end)) end (copy-marker end t))
- completion-in-region--data (list (+ 0 beg) end table pred completion-extra-properties))
+ (let ((props completion-extra-properties))
+ (when (eq (car props) :corfu--state)
+ (dolist (s (cadr props)) (set (car s) (cdr s)))
+ (setq props (cddr props)))
+ (setq end (if (and (markerp end) (marker-insertion-type end)) end (copy-marker end t))
+ completion-in-region--data (list (+ 0 beg) end table pred props)))
(completion-in-region-mode)
(activate-change-group (setq corfu--change-group (prepare-change-group)))
(setcdr (assq #'completion-in-region-mode minor-mode-overriding-map-alist) corfu-map)