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.
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.
On macOS when running Emacs in a terminal, the ns-system-appearance
variable is defined, but set to nil. We now cater for that, and simply
default to loading the dark theme.
Emacs will now change theme automatically on macOS when system
appearance is changed between light/dark. And also sets the appropriate
theme on startup too.
Caddy can now format Caddyfiles with the "caddy fmt" command, so we use
reformatter to create a format-on-save mode for Caddyfiles.
Also there's no need for the weird whitespace-mode workaround, as we now
use tab indentation in Caddyfiles, since that's what "caddy fmt"
produces.
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.
These macros work more or less like add-to-list, except they will always
leave ELEMENT as the first/last element in the list, while add-to-list
does not modify the list if ELEMENT is already present anywhere in the
list.
Remove nearly all custom behavior with consult.
The separate groups for project and non-project buffers within
consult-buffer weren't as useful after switching away from orderless to
fussy for completion scoring, as non-project buffers were often sorted
higher than project buffers.
And there's no need for the custom siren-consult-projectile-buffer
function, as consult-project-buffer does the same thing when configured
to use projectile's root path function.
There is a clang-format package in MELPA, but I believe a
reformatter-based solution works better. Hence I've made my own,
somewhat like a package, and simply thrown it into the vendor directory.