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

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

[elpa] externals/corfu d2efee4da1 1/2: README: Document aggressive auto


From: ELPA Syncer
Subject: [elpa] externals/corfu d2efee4da1 1/2: README: Document aggressive auto completion settings
Date: Sun, 26 Jun 2022 06:57:24 -0400 (EDT)

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

    README: Document aggressive auto completion settings
    
    See https://github.com/minad/cape/issues/52 for the discussion.
---
 README.org | 44 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 4 deletions(-)

diff --git a/README.org b/README.org
index d7bdad72a0..9797f0a235 100644
--- a/README.org
+++ b/README.org
@@ -172,10 +172,46 @@ unexpectedly.
         corfu-quit-no-match 'separator) ;; or t
 #+end_src
 
-In general, I recommend to experiment a bit with the various settings and key
-bindings to find a configuration which works for you. There is no one size fits
-all solution. Some people like auto completion, some like manual completion,
-some want to cycle with TAB and some with the arrow keys...
+I recommend to experiment a bit with the various settings and key bindings to
+find a configuration which works for you. There is no one size fits all
+solution. Some people like auto completion, some like manual completion, some
+want to cycle with TAB and some with the arrow keys.
+
+In case you like aggressive auto completion settings, where the completion 
popup
+appears immediately, I recommend to use a cheap completion style like =basic=,
+which performs prefix filtering. In this case Corfu completion should still be
+very fast in buffers with efficient completion backends. You can try the
+following settings in an Elisp buffer.
+
+#+begin_src emacs-lisp
+  ;; Aggressive completion, cheap prefix filtering.
+  (setq-local corfu-auto t
+              corfu-auto-delay 0
+              corfu-auto-prefix 0
+              completion-styles '(basic))
+#+end_src
+
+If you want to combine fast prefix filtering and Orderless filtering you can
+still do that by defining a custom Orderless completion style via
+=orderless-define-completion-style=. We use a custom style dispatcher, which
+enables prefix filtering for input shorter than 4 characters. Note that such a
+setup is quite advanced. Please refer to the Orderless documentation and source
+code for further details.
+
+#+begin_src emacs-lisp
+  (defun orderless-fast-dispatch (word index total)
+    (and (= index 0) (= total 1) (length< word 4)
+         `(orderless-regexp . ,(concat "^" (regexp-quote word)))))
+
+  (orderless-define-completion-style orderless-fast
+    (orderless-dispatch '(orderless-fast-dispatch))
+    (orderless-matching-styles '(orderless-literal orderless-regexp)))
+
+  (setq-local corfu-auto t
+              corfu-auto-delay 0
+              corfu-auto-prefix 0
+              completion-styles '(orderless-fast))
+#+end_src
 
 ** Completing with Corfu in the minibuffer
 



reply via email to

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