I've set `lexical-binding` to `nil` in all Emacs Lisp files to suppress
the warnings introduced in Emacs 31 requiring all elisp files to have a
`lexical-binding` comment.
This retains the default behavior of dynamic binding when no
`lexical-binding` comment is present. With it set to `t` across the
board, various things break, and fixing those is a task for another day.
This somewhat works around some changes to cape, which I was abusing to
effectively get a capf yasnippet function that would only return results
on exact matches. This allows normal lsp completion to work just fine,
except for exact matches against specific snippets.
Now we use the yasnippet-capf package instead, no longer needing the
company-yasnippet package, and hacking it to also only give a single
result back, with some caveats.
Show project relative file paths even when project root and file paths
start with a mixure of "~/" and absolute path.
Also handle buffers not backed by a file on disk by falling back onto
marginalia--buffer-file.
On later commits, I have intermittent weird issues while typing with a
copilot overlay active. Until I have to time further investigate and
report an issue, I will have to pin copilot.el to a earlier commit.
Essentially, if accepted completion string matches a given regexp
pattern, text can be inserted both before and after point.
This is useful in certain situations where Copilot suggests the opening
line to a if statement, for loop, etc., which leads to unbalanced curly
brackets. This can help reduce the annoyance of unbalanced brackets.
Instead of stripping away curly brackets at the end of the completion
texts, simply insert a closing curly bracket after point when accepting
a completion that ends with a curly bracket.
In languages that uses "{" for blocks, accepting a Copilot completion
that ends with "{", causing a structural imbalance, which
structural-based packages like smartparens does not like and causes
headaches.
With the custom accept function, trailing "{" chars along with any
whitespace before it, are ignored from Copilot completion. An exception
is made for if the removal of trailing "{" and whitespace yields an
empty completion, in which case the completion is accepted as is.
When lsp-mode is active, it tries to ensure it's own
lsp-completion-at-point function is listed before any other functions in
completion-at-point-functions.
This however prevents completions for yasnippet snippets and
files/folders from working, as completion never moved on beyond
lsp-completion-at-point. Previously I had managed to fix this by using
the DEPTH option of add-hook to get siren-yasnippet-capf and cape-file
to run before lsp-completion-at-point.
But it seems lsp-mode has changed from using add-hook to a more custom
method of always ensuring lsp-completion-at-point is always first on the
list. Hence we need to the same using the new siren-prepend macro I
recently added.
Previously we only hide company-mode's in-line preview when there was
only a single result. This meant that it didn't show the one result
anywhere.
This allows company-mode to still show it's regular popup even when
there's only one result.
I opted for accepting copilot completions using C-<tab> /
<backtab> (shift+tab) instead of regular tab, as it was often getting in
the way of yasnippet and lsp completion suggestions. This allows a more
explicit acceptance of Copilot suggestions.
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.
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.
I'm not fully convinced with swapping out ido with selectrum, so I'll
add the configuration for both, without actually loading them, and
instead manually try them out from time to time.
Also, make ivy use prescient for filtering and sorting, as it does a
much better job than ivy itself does by default. But nothing currently
uses ivy either, so it's more for future if I start using ivy somewhere.
There are a few major modes which are not based on prog-mode, that I
want to behave like prog-mode. Previously each did nearly all the same
setup that's done via the prog-mode hooks. Now instead let's actually
run runs the hooks for prog-mode.
The original code to fix the incompatibility didn't see to work anymore,
so refactored it a bit to so it goes about things a bit more carefully,
and that seemed to fix it.