Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fast orderless completion style example wrong(?) #220

Closed
Walheimat opened this issue Aug 20, 2022 · 1 comment
Closed

Fast orderless completion style example wrong(?) #220

Walheimat opened this issue Aug 20, 2022 · 1 comment

Comments

@Walheimat
Copy link

I was looking into orderless and was following the README and noticed that Emacs complained about an unused let binding.

The example (https://github.com/minad/corfu#auto-completion):

(orderless-define-completion-style orderless-fast
  ;; Should probably be `orderless-style-dispatchers', `orderless-dispatch' is a function.
  (orderless-dispatch '(orderless-fast-dispatch))
  (orderless-matching-styles '(orderless-literal orderless-regexp)))

This is so minor that I didn't want to open a PR just for it, but I think this is wrong.

@minad minad closed this as completed in 5342363 Aug 20, 2022
@minad
Copy link
Owner

minad commented Aug 20, 2022

That's right. This hasn't been noticed for a while, since I don't really recommend that approach anymore. Instead it is better to define a limited basic completion style. But the optimization is hardly worth it. One shouldn't use these overly aggressive auto completion settings anyway.

(defun basic-limited-all-completions (string table pred point)
  (when (length< string 4)
    (completion-emacs21-all-completions string table pred point)))

(defun basic-limited-try-completion (string table pred point)
  (when (length< string 4)
    (completion-emacs21-try-completion string table pred point)))

(add-to-list 'completion-styles-alist
             '(basic-limited
               basic-limited-try-completion
               basic-limited-all-completions
               "Limited basic completion."))

See minad/cape#52 for the discussion which motivated these completion styles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants