fix: stop Emacs from hanging on consult-line

Emacs was sometimes seemingly crashing when calling consult-line.
This is fixed by better orderless-settings.
This commit is contained in:
Swarsel 2024-07-17 12:39:53 +02:00
parent e1a65b47a6
commit 0cae61e3ec
Signed by: swarsel
GPG key ID: 26A54C31F2A4FD84
2 changed files with 31 additions and 10 deletions

View file

@ -6601,7 +6601,7 @@ The rest of this configuration is found here:
:CUSTOM_ID: h:fbec0bd4-690b-4f79-8b2b-a40263760a96 :CUSTOM_ID: h:fbec0bd4-690b-4f79-8b2b-a40263760a96
:END: :END:
Setting up firefox along with some policies that are important to me (mostlu disabling telemetry related stuff as well as Pocket). I also enable some integrations that enable super useful packages, namely =tridactyl= and =browserpass=. Setting up firefox along with some policies that are important to me (mostly disabling telemetry related stuff as well as Pocket). I also enable some integrations that enable super useful packages, namely =tridactyl= and =browserpass=.
Also, using NUR with rycee's firefox addons, it is very convenient for me to add firefox addons here that will be automatically installed. Also, using NUR with rycee's firefox addons, it is very convenient for me to add firefox addons here that will be automatically installed.
@ -8464,15 +8464,26 @@ This package allows for =Ido=-like directory navigation.
:CUSTOM_ID: h:211fc0bd-0d64-4577-97d8-6abc94435f04 :CUSTOM_ID: h:211fc0bd-0d64-4577-97d8-6abc94435f04
:END: :END:
The completion styles that I chose here can possibly still be improved. I need to spend more time on this. When first installing orderless, I often times faced the problem, that when editing long files and calling =consult-line=, Emacs would hang when changing a search term in the middle (e.g. from =servicse.xserver= to =servic.xserver= in order to fix the typo). The below orderless rules have a more strict matching that has a positive impact on performance.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package orderless (use-package orderless
:custom :config
(completion-styles '(orderless flex basic)) (orderless-define-completion-style orderless+initialism
(completion-category-overrides '((file (styles . (partial-completion))) (orderless-matching-styles '(orderless-initialism orderless-literal orderless-regexp)))
(eglot (styles orderless))))) (setq completion-styles '(orderless)
completion-category-defaults nil
completion-category-overrides
'((file (styles partial-completion orderless+initialism))
(buffer (styles orderless+initialism))
(consult-multi (styles orderless+initialism))
(command (styles orderless+initialism))
(eglot (styles orderless+initialism))
(variable (styles orderless+initialism))
(symbol (styles orderless+initialism)))
orderless-matching-styles '(orderless-literal orderless-regexp)))
#+end_src #+end_src

View file

@ -623,10 +623,20 @@ create a new one."
:hook (rfn-eshadow-update-overlay . vertico-directory-tidy)) :hook (rfn-eshadow-update-overlay . vertico-directory-tidy))
(use-package orderless (use-package orderless
:custom :config
(completion-styles '(orderless flex basic)) (orderless-define-completion-style orderless+initialism
(completion-category-overrides '((file (styles . (partial-completion))) (orderless-matching-styles '(orderless-initialism orderless-literal orderless-regexp)))
(eglot (styles orderless))))) (setq completion-styles '(orderless)
completion-category-defaults nil
completion-category-overrides
'((file (styles partial-completion orderless+initialism))
(buffer (styles orderless+initialism))
(consult-multi (styles orderless+initialism))
(command (styles orderless+initialism))
(eglot (styles orderless+initialism))
(variable (styles orderless+initialism))
(symbol (styles orderless+initialism)))
orderless-matching-styles '(orderless-literal orderless-regexp)))
(use-package consult (use-package consult
:config :config