GNU bug report logs -
#64784
30.0.50; Eglot: Lisp error: (wrong-type-argument number-or-marker-p return) in eglot--post-self-insert-hook
Previous Next
Reported by: Tassilo Horn <thorn <at> fastmail.fm>
Date: Sat, 22 Jul 2023 05:11:02 UTC
Severity: normal
Found in version 30.0.50
Done: João Távora <joaotavora <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
João Távora <joaotavora <at> gmail.com> writes:
Hi João,
> Even before Stefan answers, 'last-command-event' sounds right to me.
> In latest master, I've replaced the previous hacky solution with a
> simplified one based on this 'last-command-event' and it doesn't need
> any translation and works correctly on both TTY and GUI Emacs.
>
> Tassilo, can you test?
I can say at least that the error is gone. Thank you!
(The below isn't actually related to the bug but to the feature the code
is providing.)
And now I also looked what that code is actually doing: you do
eglot-format after some trigger characters which seem to be queried from
the LS. In my case of rust-analyzer, that seems to be
(:firstTriggerCharacter "=" :moreTriggerCharacter ["." ">" "{"])
eglot-format works good in that buffer and seems to do exactly what
rustfmt also does. Here I have a problem with rust-ts-mode which seems
to have a sightly different idea about the indentation of some
constructs, e.g., eglot-format and rustfmt say this is "correct"
fn is_prev_next_window_variant(&self) -> bool {
matches!(
self,
SwayrCommand::NextWindow { .. }
| SwayrCommand::PrevWindow { .. }
| SwayrCommand::NextTiledWindow { .. }
| SwayrCommand::PrevTiledWindow { .. }
| SwayrCommand::NextTabbedOrStackedWindow { .. }
| SwayrCommand::PrevTabbedOrStackedWindow { .. }
| SwayrCommand::NextFloatingWindow { .. }
| SwayrCommand::PrevFloatingWindow { .. }
| SwayrCommand::NextWindowOfSameLayout { .. }
| SwayrCommand::PrevWindowOfSameLayout { .. }
| SwayrCommand::NextMatchingWindow { .. }
| SwayrCommand::PrevMatchingWindow { .. }
)
}
while rust-ts-mode prefers this:
fn is_prev_next_window_variant(&self) -> bool {
matches!(
self,
SwayrCommand::NextWindow { .. }
| SwayrCommand::PrevWindow { .. }
| SwayrCommand::NextTiledWindow { .. }
| SwayrCommand::PrevTiledWindow { .. }
| SwayrCommand::NextTabbedOrStackedWindow { .. }
| SwayrCommand::PrevTabbedOrStackedWindow { .. }
| SwayrCommand::NextFloatingWindow { .. }
| SwayrCommand::PrevFloatingWindow { .. }
| SwayrCommand::NextWindowOfSameLayout { .. }
| SwayrCommand::PrevWindowOfSameLayout { .. }
| SwayrCommand::NextMatchingWindow { .. }
| SwayrCommand::PrevMatchingWindow { .. }
)
}
I actually like the rust-ts-mode variant better but don't find a
(stable) knob in the rustfmt.config to make it agree. Anyway, I have no
strong preference but frequently produce such needless whitespace
changes during editing (which, of course, cargo fmt will "repair").
So is there a way to stop the indentation wars? Maybe if I could make
it so that return and tab would also be considered as trigger characters
for eglot-format?
Bye,
Tassilo
This bug report was last modified 1 year and 306 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.