diff options
| author | Daniel Mendler <mail@daniel-mendler.de> | 2022-02-12 16:41:29 +0100 |
|---|---|---|
| committer | Daniel Mendler <mail@daniel-mendler.de> | 2022-02-12 16:41:29 +0100 |
| commit | d12ecbc719b0045ec0ea1be85650b56661ad37af (patch) | |
| tree | 2e08cc06a929f46a1ec5c77c1fb4560ccc62c0af | |
| parent | 5910be7c7036a476f435b33f6cfbf8c1ddb4155e (diff) | |
Remove corfu-commit-predicate, introduce value `insert' for corfu-preview-current
| -rw-r--r-- | corfu.el | 34 |
1 files changed, 17 insertions, 17 deletions
@@ -71,22 +71,26 @@ The value should lie between 0 and corfu-count/2." "Continue Corfu completion after executing these commands." :type '(repeat (choice regexp symbol))) -(defcustom corfu-commit-predicate #'corfu-candidate-previewed-p - "Automatically commit if the predicate returns t." - :type '(choice (const nil) function)) - -(defcustom corfu-preview-current t - "Preview currently selected candidate." - :type 'boolean) +(defcustom corfu-preview-current 'insert + "Preview currently selected candidate. +If the variable has the value `insert', the candidate is automatically +inserted on further input." + :type '(choice boolean (const insert))) (defcustom corfu-preselect-first t "Preselect first candidate." :type 'boolean) -(make-obsolete +(defvar corfu-quit-at-boundary nil) +(defvar corfu-commit-predicate nil) +(make-obsolete-variable 'corfu-quit-at-boundary "See the new `corfu-separator' customization." "0.19") +(make-obsolete-variable + 'corfu-commit-predicate + "Set `corfu-preview-current' to the value `insert'." + "0.19") (defcustom corfu-separator ?\s "Component separator character. @@ -227,7 +231,7 @@ The completion backend can override this with (define-key map "\t" #'corfu-complete) (define-key map "\eg" #'corfu-show-location) (define-key map "\eh" #'corfu-show-documentation) - (define-key map "\e " #'corfu-insert-separator) + (define-key map (concat "\e" " ") #'corfu-insert-separator) ;; Avoid ugly warning map) "Corfu keymap used when popup is shown.") @@ -835,15 +839,11 @@ there hasn't been any input, then quit." (when corfu--preview-ov (delete-overlay corfu--preview-ov) (setq corfu--preview-ov nil)) - (when (and corfu-commit-predicate - (not (corfu--match-symbol-p corfu-continue-commands this-command)) - (funcall corfu-commit-predicate)) + (when (and (eq corfu-preview-current 'insert) + (/= corfu--index corfu--preselect) + (not (corfu--match-symbol-p corfu-continue-commands this-command))) (corfu--insert 'exact))) -(defun corfu-candidate-previewed-p () - "Return t if a candidate is selected and previewed." - (and corfu-preview-current (/= corfu--index corfu--preselect))) - (defun corfu-insert-separator () "Insert a separator character, inhibiting quit on completion boundary." (interactive) @@ -1176,7 +1176,7 @@ Auto completion is only performed if the tick did not change." ;;;###autoload (define-minor-mode corfu-mode - "Completion Overlay Region FUnction" + "Completion Overlay Region FUnction." :global nil :group 'corfu (cond (corfu-mode |
