I've decided to do things another way. This will be managed by either
machine-specific configurations or Guix. I'm leaving the rest in place for now
and will replace as necessary.
I was trying to think of a good keybinding that I would like, and then I
remembered that kitty uses the ‘C-S-e’ keybinding and I've grown accustomed to
it.
This is a new variable in Emacs 30 that lets me specify which directories can be
trusted with local variable values. (Or it should be, I haven't seen it
available yet.)
When Emacs is first started ‘treesit-extra-load-path’ is empty and any
‘(treesit-language-available-p ...)’ will return nil. But calling, for example,
‘bash-ts-mode’ will work if the package is installed in Guix and will fill the
variable.
- Set the ‘treesit-extra-load-path’ to the value of ‘TREE_SITTER_GRAMMAR_PATH’.
Emacs doesn't seem to do this automatically, but Guix sets that variable when
grammars get installed.
- Add ‘bash-ts-mode’ to the ‘interpreter-mode-alist’. In his article[1] about
tree sitter support in Emacs Mickey Petersen mentions that it's best to use
‘major-mode-remap-alist’, however in his example he remaps ‘bash-mode’ to
‘bash-ts-mode’, but there is no ‘bash-mode’. Setting the
‘interpreter-mode-alist’ like this still works.
[1]: https://www.masteringemacs.org/article/how-to-get-started-tree-sitter
When everything is interpreted it all works fine because ‘consult’ is loaded
before the ‘with-eval-after-load’ part is run, but when byte compiling the byte
compiler doesn't know that ‘consult-customize’ is a macro unless ‘consult’ is
loaded, which it isn't when Guix compiles it.
When it's byte-compiled as if it's a function ‘consult-buffer’ is assumed to be
a variable that's passed in, so I'm guessing it's trying to dereference it first
before passing it on to a non-existent function? But of course ‘consult-buffer’
is only a function (Emacs Lisp is a Lisp-2 after all), so it fails, but only
when byte compiled (and even only when byte-compiled in a clean environment
where there are no packages loaded that aren't explicity said to be).
Hopefully this fixes my issue with being unable to switch buffers until I
explicitly load ‘consult’.
This reverts commit 961651e575.
It works in an interactive session, but still fails while starting up. Probably
has to do with autoloads not having finished loading yet, perhaps?
This macro seems to work fine when expanded at run-time even when ‘consult’
hasn't been loaded, but it doesn't work after it's been byte-compiled... Perhaps
putting it in the top-level will help. I'm wondering if somehow the byte
compiler closes over a reference to ‘consult-buffer’ during compilation that's
not available when it executes?
I'm having some issues with my ‘consult-buffer’ setup and I'm hoping that
putting this in its own function will help me debug the issue, or at least show
me if this is part of the issue or not.
The various ‘M-<NUMBER>’ keybindings are all also bound to ‘C-<NUMBER>’, no need
to have both, and using ‘M-0’ is a lot easier than using ‘C-x 0’. This also
replaces the old keybindings with a message that tells me to use the new
keybindings instead to help me learn.
There are some programs that live in both that and some other directories that
I've added on Windows. This makes sure that the cygwin ones don't overwrite
everything else, since usually I use different versions like MSYS2.
This also brings in marginalia, orderless, consult, and embark.
I've been reading about these projects for a while and after some looking around
it seems like these are at the very least interesting, I'm trying it out for a
while.