kosakgroove · 2022-12-30 13:12
Hi everyone! I am an Emacs newbie, using it now for \~2months, and I am still with my mouth open everyday on how amazing it is. Thanks to all the people that have worked hard on Emacs and also plugin creators!!!
I have created my own config from scratch after having used Doom briefly and Prelude extensively. This is working far better, and it's teaching me a lot.
On a side note, I would really appreciate feedback into how this config can be improved, best practices, better choices, etc.
See my config here: [https://github.com/averageflow/dotfiles/tree/master/joeTumbleweedIKEADell/emacs](https://github.com/averageflow/dotfiles/tree/master/joeTumbleweedIKEADell/emacs)
I use a variety of packages, including consult, marginalia, vertico, corfu and orderless, use-package with straight.
I love orderless, and when I manually enable it, works wonderful, but for some reason, it doesn't get properly activated in my setup (init.el) when following the documentation:
(use-package orderless
:custom
(setq completion-styles '(orderless basic)
completion-category-overrides '((file (styles basic partial-completion))))
)
When I do (print completion-styles) it gives me just (basic). Somehow it gets overriden I think ?
I've also tried to change that :custom by :config and to use the setq outside the use-package block, to no avail.
So I have had to resort to
(custom-set-variables
'(completion-styles '(orderless basic))
)
And this seems to work. But how can I / should I get rid of it this way?
Why doesn't it work in the use-package declaration? Thanks!
yapfff · 2022-12-30 14:10
The syntax for a`:custom` section is wrong, see below. And it likely does not work with `:config` because by default `use-package` does lazy loading, and the `orderless` package is not loaded in your case. You can explicitly load a package with `:demand t`. The below should work:
(use-package orderless
:demand t
:custom
(completion-styles '(orderless basic))
(completion-category-overrides '((file (styles basic partial-completion)))))
Note that with orderless before basic in the completion style the basic tab completion will not work. You can reverse the order to keep tab completion. It won't be a problem with orderless as as soon as you use a complex query it won't be a prefix and orderless will still kick in. So I'd recommend `'(basic orderless)` instead.
deepaknegilachu · 2022-12-30 14:16
What are major differences between fido-vertical-mode and vertico?
kosakgroove · 2022-12-30 14:44
Thanks for explaining, will soon try
kosakgroove · 2022-12-30 15:05
Thanks for your tip, but it still gives the same result..
KozureOkami · 2022-12-30 17:15
> When I do (print completion-styles)
Slight off-topic, but I recommend using Emacs' built-in help system instead of printing the values of variables, i.e. `C-h v` then enter `completion-styles`. This includes a lot more information (default value, current value, documentation) and useful information like
> Note that `completion-category-overrides` may override these styles for specific categories, such as files, buffers, etc.
so maybe inspect that variable too.
takutekato · 2022-12-30 17:40
The quickest option to me is changing `custom` to `init`.
eleven_cupfuls · 2022-12-30 18:54
Correction, `use-package` does [_not_ lazy load by default](https://github.com/jwiegley/use-package/#notes-about-lazy-loading), _unless_ there are autoloaded things included in the block (`:commands`, `:bind`, `:mode`, ...). None of those things are present here.
thetemp_ · 2022-12-30 19:23
Suggestion: get it to work without `use-package` first. Then, after it's doing what you want using just Emacs-Lisp, you can rewrite it using the use-package macro's keywords. In this way, you'll have a better understanding of exactly what you're trying to get use-package to do before translating that intent into the more abstracted syntax of use-package's various keywords.
There are basically 2 things you want to happen. You want the "orderless.el" package to get loaded, and you want the `completion-styles` list to be set so that `orderless` will be the first element (or at least so that it will be one of the elements).
Simplest way to get orderless.el loaded is to put `(require 'orderless)` in your init file. You can check that it has loaded by evaluating `(featurep 'orderless)` (which will return `t` if it has).
You can set `completion-styles` using the `customize-set-variable` function. Note that this is different from `custom-set-variables` which you used above. I would advise against using that, because the "Customize" interface saves its settings in the `custom-set-variables` block, and it expects there to only be one of them. So you may encounter unpleasant surprises if you create that block yourself.
kosakgroove · 2022-12-30 20:04
What about using it with straight.el ?