From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.bugs 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 Message-ID: <875y6bm5ut.fsf@fastmail.fm> References: <87bkg4bkfu.fsf@fastmail.fm> <83a5voa328.fsf@gnu.org> <87h6pw9tpa.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27376"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.11.10; emacs 30.0.50 Cc: Eli Zaretskii , Stefan Monnier , 64784@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 23 09:43:24 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qNTkR-0006yB-9y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 23 Jul 2023 09:43:23 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qNTk7-0000LF-T6; Sun, 23 Jul 2023 03:43:03 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNTk6-0000Ks-Ny for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2023 03:43:02 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNTk6-0000vz-Gd for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2023 03:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qNTk6-00021V-Aa for bug-gnu-emacs@gnu.org; Sun, 23 Jul 2023 03:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tassilo Horn Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 23 Jul 2023 07:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 64784 X-GNU-PR-Package: emacs Original-Received: via spool by 64784-submit@debbugs.gnu.org id=B64784.16900981537740 (code B ref 64784); Sun, 23 Jul 2023 07:43:02 +0000 Original-Received: (at 64784) by debbugs.gnu.org; 23 Jul 2023 07:42:33 +0000 Original-Received: from localhost ([127.0.0.1]:37883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNTjd-00020l-9I for submit@debbugs.gnu.org; Sun, 23 Jul 2023 03:42:33 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55998) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qNTjb-00020Z-27 for 64784@debbugs.gnu.org; Sun, 23 Jul 2023 03:42:32 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qNTjU-0000rU-M3; Sun, 23 Jul 2023 03:42:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-reply-to:Date:Subject:To:From: References; bh=KE4KPyjQXCOm0TBGH5hXHHo2kTNVnPyT/GH0/xb2cis=; b=RpuNhqF5AxAQc5 Ec/b6DVPCFr/tB4vWbw0J2QGOUcsQcj+qRKaPABAYgCmEYd23e9/w1SGn2dhs3KB9gv2qtzyO2b5W +rdUBYTjiWS31xeQjmLB//fDCADSQmtNMhsiqwki8raPvx8hBHZqVvJLE9ewcSoaTaoXlJaahS6Gw DL6PRaOH0M1gkcZy+E4VLDf0z68Lddu6w8eXn0iTdO+6csKf/brH5uCNbOvpm4ITAynA4fWV9llG0 9xAJKt2y8sib+3qMb5wyGqoAm58vZioY0OojSOi6K82kSm+fHlkRCF6pGIRSNV9hlQjqwwsw1/8Ms UnAKRWh6PnLRdqIkN+9Q==; Original-Received: from auth2-smtp.messagingengine.com ([66.111.4.228]) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qNTjU-0001TO-Dh; Sun, 23 Jul 2023 03:42:24 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailauth.nyi.internal (Postfix) with ESMTP id 00D6A27C005A; Sun, 23 Jul 2023 03:42:22 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 23 Jul 2023 03:42:23 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedviedrheehgdduvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvvefuffgjkfggtgfgsehtqhertddtreejnecuhfhrohhmpefvrghs shhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhrgheqnecuggftrfgrthhtvghrnh epgfettdduiedvhfffhfefhfevhfeuvdehjeejfeelffehkeffuedthffgjeeihfegnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhrnh domhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqkeeijeefkeejkeegqdeifeeh vdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshhtmhgrihhlrdhfmh X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 23 Jul 2023 03:42:21 -0400 (EDT) In-reply-to: <87h6pw9tpa.fsf@gmail.com> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:265867 Archived-At: Jo=C3=A3o T=C3=A1vora writes: Hi Jo=C3=A3o, > 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 "=3D" :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