emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/corfu b71465fa6b: Reintroduce corfu-quit-at-boundary (F


From: ELPA Syncer
Subject: [elpa] externals/corfu b71465fa6b: Reintroduce corfu-quit-at-boundary (Fix #138)
Date: Tue, 1 Mar 2022 11:57:20 -0500 (EST)

branch: externals/corfu
commit b71465fa6b6588babc98a1ae7034c9a41e5eaca7
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Reintroduce corfu-quit-at-boundary (Fix #138)
---
 README.org | 12 +++++++-----
 corfu.el   | 31 ++++++++++++++++---------------
 2 files changed, 23 insertions(+), 20 deletions(-)

diff --git a/README.org b/README.org
index 7523814272..b00e57b0cf 100644
--- a/README.org
+++ b/README.org
@@ -84,6 +84,7 @@
       ;; (corfu-cycle t)                ;; Enable cycling for 
`corfu-next/previous'
       ;; (corfu-auto t)                 ;; Enable auto completion
       ;; (corfu-separator ?\s)          ;; Orderless field separator
+      ;; (corfu-quit-at-boundary nil)   ;; Never quit at completion boundary
       ;; (corfu-quit-no-match nil)      ;; Never quit, even if there is no 
match
       ;; (corfu-preview-current nil)    ;; Disable current candidate preview
       ;; (corfu-preselect-first nil)    ;; Disable candidate preselection
@@ -270,11 +271,12 @@ Then, when a new orderless component is desired, use 
=M-SPC=
 and arbitrary orderless search terms and new separators can be entered
 thereafter.
 
-Note that ~corfu-separator~ replaced the older less general option
-~corfu-quit-at-boundary~. If you want similar behavior as with
-~corfu-quit-at-boundary=nil~, you can bind ~corfu-insert-separator~ to =SPC= in
-~corfu-map~. In contrast, if you /always/ want to quit at the boundary, simply 
set
-~corfu-separator~ to ~nil~.
+To treat the entire input as Orderless input, you can set the customization
+option ~corfu-quit-at-boundary=t~. This disables the predicate which checks if 
the
+current completion boundary has been left. In contrast, if you /always/ want to
+quit at the boundary, simply set ~corfu-quit-at-boundary=nil~. By default
+~corfu-quit-at-boundary~ is set to ~separator~ which quits at completion 
boundaries
+as long as no separator has been inserted with ~corfu-insert-separator~.
 
 Finally, there exists the user option ~corfu-quit-no-match~ which is set to
 =separator= by default. With this setting Corfu stays alive as soon as you 
start
diff --git a/corfu.el b/corfu.el
index e92bce61c9..58e20f4e14 100644
--- a/corfu.el
+++ b/corfu.el
@@ -85,12 +85,7 @@ inserted on further input."
   "Preselect first candidate."
   :type 'boolean)
 
-(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'."
@@ -98,14 +93,20 @@ inserted on further input."
 
 (defcustom corfu-separator ?\s
   "Component separator character.
-The character used for separating components in the input.  If
-non-nil, the presence of this separator character will inhibit
-quitting at completion boundaries, so that any further characters
-can be entered.  If nil, always quit at completion boundaries.
-To enter the first separator character, call
-`corfu-insert-separator' (bound to M-SPC by default).
-Useful for multi-component completion styles such as orderless."
-  :type '(choice (const nil) character))
+The character used for separating components in the input. The presence
+of this separator character will inhibit quitting at completion
+boundaries, so that any further characters can be entered. To enter the
+first separator character, call `corfu-insert-separator' (bound to M-SPC
+by default). Useful for multi-component completion styles such as
+Orderless."
+  :type 'character)
+
+(defcustom corfu-quit-at-boundary 'separator
+  "Automatically quit at completion boundary.
+nil: Never quit at completion boundary.
+t: Always quit at completion boundary.
+separator: Quit at boundary if no `corfu-separator' has been inserted."
+  :type '(choice boolean (const separator)))
 
 (defcustom corfu-quit-no-match 'separator
   "Automatically quit if no matching candidate is found.
@@ -875,7 +876,6 @@ there hasn't been any input, then quit."
 (defun corfu-insert-separator ()
   "Insert a separator character, inhibiting quit on completion boundary."
   (interactive)
-  (unless corfu-separator (error "`corfu-separator' character is nil"))
   (insert corfu-separator))
 
 (defun corfu--post-command ()
@@ -896,7 +896,8 @@ there hasn't been any input, then quit."
                         ;; Check for empty input
                         (or (not corfu--input) (< beg end))
                         ;; Check separator or predicate
-                        (or (and corfu-separator ;; Command enables separator 
insertion
+                        (or (not corfu-quit-at-boundary)
+                            (and (eq corfu-quit-at-boundary 'separator)
                                  (or (eq this-command #'corfu-insert-separator)
                                      ;; with separator, any further chars 
allowed
                                      (seq-contains-p (car corfu--input) 
corfu-separator)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]