This is a more generic and robust fix for flx-rs not behaving correctly
when given consults extra metadata bytes as part of the input candidate.
This should now work with any candidate provided by consult, not just
those that come from the consult-buffer command.
It seems the string candidates produced by consult-buffer have some
extra non-printable bytes appended at the end. These bytes makes flx-rs
not match against the candidate properly.
Consult does add a text property to the candidate string called 'buffer,
which contains the original buffer name.
So for now, we advice the flx-rs-score function and attempt to the
extract the buffer text property from the input candidate and use that
instead. If the candidate has no such text property, we use it as is.
It seems the fzf-native scoring method can get slow and laggy over
time. It seems the flx-rs method does not, and is overall a bit faster.
However, flx-rs doesn't give exact matches as high of a score as
fzf-native, so scoring might be a bit different than I'm used to. Time
will tell if I'll find it annoying enough to switch back to fzf-native.
Also switch from orderless to fussy's all-completions backed filtering
method. This yields a noticeable improvement in speed, but it does not
support multiple search terms separated by space like orderless does.
Another potential habit I will need to adjust.
It turns out that using the 'character mode causes very noticeable
performance degradation and straight up lag when typing in a lot of
programming languages. Setting it back to 'column seems to resolved this
for me.
Simply render indent guides identical for all levels. Specifically
highlighting the current indent line makes things feel a bit "noisy",
and also doesn't always respond to changes that fast, making things feel
slow too.
Turns out the conflicts with both copilot and highlight-indent-guide was
due to the newline-mark. Hence disable newline-mark and re-enable
whitespace mode.
As I'm no longer using whitespace-mode in prog-mode derived modes, the
cursor movement bug affecting highlight-indent-guides when
whitespace-mode is enabled is no longer an issue for me.
Further details about the highlight-indent-guides conflict with
whitespace-mode is available in this issue:
https://github.com/DarthFennec/highlight-indent-guides/issues/107
When whitespace-mode is enabled, single-line copilot completions makes
the cursor look like it's at the end of the completion rather than in
it's real position.
Issue with gifs showing the behavior is here:
https://github.com/zerolfx/copilot.el/issues/28
For the most part I should be able to live without whitespace-mode in
day to day use, and improvements to the highlight-indent-guides setup
should help.
And worst case, whitespace-mode can always be toggled easily enough.
Turns out undo-tree massively increases undo limits, and the defaults
seem to cut off history for me much sooner than I'd like. So I set the
limits to the same high values are undo-tree does.
Use fussy instead of orderless for filtering and scoring/ordering
completion candidates. This seems to overall order results in a much
better way than just orderless.
Technically orderless is still used to filter the candidate list, but
fzf-native is used to score/order the results.
Also replace undohist with undo-fu-session.
Overall this seems to yield a more reliable undo history, as undo-fu and
vundo supposedly operate with vanilla emacs undo history state, while
undo-tree supposedly does some custom tweaks to the undo state.
Move away from the whitespace-cleanup-mode package, and instead simply
define our own whitespace-cleanup-on-save-mode minor-mode that uses a
before-save-hook.
This applies especially in lsp-mode. Yasnippet snippets now show as
completion candidates if the word at point exactly matches a snippet
keyword, otherwise it'll fallback to normal lsp backed completion.
And it also supports completing file/directory names now too while
lsp-mode is active.
All this is done by modifying completion-at-point-functions after
lsp-mode has done it's trickery with it. Along with a dirty hack to
company-yasnippet to make it only activate on exact matches. Without
this hack, lsp backed completion rarely activates as snippets would have
higher priority if there's any partial matches.
Using consult-buffer to switch between buffers is now project aware,
meaning when current buffer is in a project, the list of buffers is
split into two groups; project buffers, and other non-project buffers.
The project buffers group is above the other buffers group, meaning it's
very easy to switch to other buffers within the same project, while
still being able to switch to non-project buffers too.
When current buffer is not part of a project, all buffers are shown
together in a single completion group.
Occasionally right after starting Emacs, it was possible to issue a
projectile-switch-project command which ran before my hacky
vertico-directory advice had been added. This should ensure the advice
gets added earlier.
Override default straight recipe for vertico to expose extensions as
packages.
Also create hacky vertico-directory-mode to easily toggle
vertico-directory features on and off.
vertico-directory-mode is then used by a projectile advice to
temporarily disable vertico-directory features while completing results
from projectile. This is required to avoid breaking the
projectile-switch-project and related commands, as the project list is
not a set of files, but vertico-directory-enter thinks it is.
I finally resolved the lsp-mode bug I had whenever I tried vertico in
the past. It was due to me setting resize-mini-windows instead of
vertico-resize.
This is useful for annotating completion-read buffer results which all
belong to a single project, as it removes the project root from the
file path field, showing a relative path to each buffer's file from the
project root.
Personally I find orderless is giving me better results than prescient
when fuzzy/flex matching is enabled. Hence the switch to orderless.
I also split the modules apart to ensure, that selectrum, vertico,
prescient and orderless can be mixed and matched however and work
correctly.
And the switch from to vertico from selectrum is mostly cause I like
it's wraparound/cycle feature, where end/beginning of the candidate list
will wrap around.
The default 'marginalia-annotate-command annotation method for M-x
candidates has a small but perceivable performance impact as you
type. The 'marginalia-annotate-binding method does not have any
perceivable performance impact.
Also I only really care about seeing keybindings in the M-x list, I can
definitely live without command descriptions.
This is a basic setup, as I'm not very familiar with what is doable with
embark. It also takes over the goto-chg keybindings, cause that package
rarely worked correctly, so I almost never used it.
Packages that need to be loaded on emacs startup, should just be loaded
through use-package in a non-deferred manner.
It makes no real difference to startup, loading the packages either
slows down emacs before "startup" is complete, or right after it
completes. End result is that Emacs is unresponsive for basically the
same amount of time regardless.