From: Tassilo Horn <tsdh@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>,
Stefan Monnier <monnier@iro.umontreal.ca>,
64784@debbugs.gnu.org
Subject: bug#64784: 30.0.50; Eglot: Lisp error: (wrong-type-argument number-or-marker-p return) in eglot--post-self-insert-hook
Date: Sun, 23 Jul 2023 09:21:54 +0200 [thread overview]
Message-ID: <875y6bm5ut.fsf@fastmail.fm> (raw)
In-Reply-To: <87h6pw9tpa.fsf@gmail.com>
João Távora <joaotavora@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
next prev parent reply other threads:[~2023-07-23 7:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-22 5:06 bug#64784: 30.0.50; Eglot: Lisp error: (wrong-type-argument number-or-marker-p return) in eglot--post-self-insert-hook Tassilo Horn
2023-07-22 6:11 ` Eli Zaretskii
2023-07-22 9:33 ` João Távora
2023-07-22 14:05 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-23 7:21 ` Tassilo Horn [this message]
2023-07-23 10:20 ` bug#64784: LSP vs Emacs indentation [Was: bug#64784: 30.0.50; Eglot: Lisp error: (wrong-type-argument number-or-marker-p return) in eglot--post-self-insert-hook] João Távora
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=875y6bm5ut.fsf@fastmail.fm \
--to=tsdh@gnu.org \
--cc=64784@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=joaotavora@gmail.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).