Comments (8)
One simple way to do it would be to set completion-styles
to whatever you want to use for corfu and company, and add to minibuffer-mode-hook
a function that set the completion-styles
locally in the minibuffer to something that includes orderless. Like this:
(setq completion-styles '(basic partial-completion)) ; styles for corfu & company
(defun use-orderless ()
(setq-local completion-styles '(orderless))) ; styles for minibuffer commands such as consult commands
(add-hook 'minibuffer-mode-hook #'use-orderless)
But maybe, in case this is an XY problem, let me ask: why do you want to disable orderless for corfu and company?
from orderless.
Hi @oantolin , yeah I prefer company/corfu use substring for completion. When I type something, normally I can remember the prefix of what I am trying to type, so orderless is an overkill for me.
from orderless.
One simple way to do it would be to set completion-styles to whatever you want to use for corfu and company, and add to minibuffer-mode-hook a function that set the completion-styles locally in the minibuffer to something that includes orderless.
That's not such a good fix actually, when taking more packages like Consult into account. I haven't found the ideal fix for Corfu yet to be honest. The problem with activating orderless only within the minibuffer is that it doesn't play nicely with consult-line
which uses the completion-styles
to jump to the position of the match (even after closing the minibuffer). One could then work around this problem by setting completion-category-overrides
for consult-location
but that's also not great. For Company the solution is to modify the completion styles with an advice around company-capf
. Such an advice does not work for Corfu since Corfu uses completion-all-completions
and completion-try-completion
at many more places.
from orderless.
Fair enough, @ydzhou.
I obviously hadn't checked all the consequences, @minad. Thanks for pointing those issues out. As for a good way to control completion-styles for Corfu, is there any way to detect if Corfu is currently open, some varíable or something? If so, one could write a new completion style that simply delegates to one completion style or another depending on whether Corfu is asking or not.
from orderless.
Also, consult-line already stores a marker in a text property, right? Isn't that marker obtained while the minibuffer is open? Why does it need to use completion again. Or am I just wrong about the location being stored in a text property, @minad ?
from orderless.
In order to highlight the matches.
from orderless.
In order to highlight the matches.
Oh, right!
from orderless.
This works, but messy.
(defvar osfva-default-completion-styles
(let ((sv (get 'completion-styles 'standard-value)))
(and (consp sv)
(condition-case nil
(eval (car sv) t)
(error completion-styles)))))
(defvar osfva-enable-orderless-in-company nil)
(defun osfva-toggle-enable-orderless-in-company ()
(interactive)
(setq osfva-enable-orderless-in-company
(not osfva-enable-orderless-in-company)))
(defun osfva-company-disable-orderless (orig-fun &rest args)
"Diable orderless completion style when company is doing the completion."
(let ((completion-styles (if osfva-enable-orderless-in-company
completion-styles
osfva-default-completion-styles)))
(apply orig-fun args)))
(advice-add #'company--perform :around #'osfva-company-disable-orderless)
from orderless.
Related Issues (20)
- Possible conflict between orderless and AUCTeX HOT 28
- Orderless matches all TRAMP methods HOT 23
- Orderless with vertico cannot case-insensitively search files by default HOT 2
- Keybinding to switch between smart and strict case HOT 1
- GitHub-rendered readme is "Style dispatchers" section is misleading/hard to read HOT 3
- cannot rename with orderless HOT 1
- Warning: Value for ‘orderless-matching-styles’ does not match type hook HOT 2
- Quickly exclude several types of candidates HOT 3
- Case insensitivity not working for Upper case. HOT 2
- [FR] Add option for find-file to match only file name. HOT 7
- [Q] How do I use `orderless-style-dispatchers` with `ivy`? HOT 3
- Compatibility problem with lsp-bridge? (wrong-type-argument stringp (seq (group 100))) HOT 8
- Questions about annotation matching HOT 5
- New release 1.1? HOT 5
- consult-locate not supported Chinese Pinyin first letter search HOT 3
- Is it possible to include spaces in orderless-literal? HOT 2
- `orderless-not` ignores smart case
- High CPU usage on normal operations HOT 1
- Use & to match affixation prefix HOT 6
- How to set `orderless-affix-dispatch-alist` for a certain function? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from orderless.