From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#70724: 29.2.50; eglot-reconnect errors when the project is deleted Date: Thu, 6 Jun 2024 23:36:11 +0300 Message-ID: <8c915fa2-227f-475b-a380-b4f4d83e525f@gutov.dev> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2811"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: app-emacs-dev@janestreet.com, =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: Spencer Baugh , 70724-done@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 06 22:37:14 2024 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 1sFJrF-0000US-Ih for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Jun 2024 22:37:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sFJqr-0003hL-Jo; Thu, 06 Jun 2024 16:36:49 -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 1sFJqq-0003gu-3d for bug-gnu-emacs@gnu.org; Thu, 06 Jun 2024 16:36:48 -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 1sFJqp-0003An-Rc for bug-gnu-emacs@gnu.org; Thu, 06 Jun 2024 16:36:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sFJr4-0005oo-KH for bug-gnu-emacs@gnu.org; Thu, 06 Jun 2024 16:37:02 -0400 Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Jun 2024 20:37:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 70724 X-GNU-PR-Package: emacs Mail-Followup-To: 70724@debbugs.gnu.org, dmitry@gutov.dev, sbaugh@janestreet.com Original-Received: via spool by 70724-done@debbugs.gnu.org id=D70724.171770619822293 (code D ref 70724); Thu, 06 Jun 2024 20:37:02 +0000 Original-Received: (at 70724-done) by debbugs.gnu.org; 6 Jun 2024 20:36:38 +0000 Original-Received: from localhost ([127.0.0.1]:39843 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFJqg-0005nT-1n for submit@debbugs.gnu.org; Thu, 06 Jun 2024 16:36:38 -0400 Original-Received: from wfhigh2-smtp.messagingengine.com ([64.147.123.153]:59059) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sFJqd-0005n6-OI for 70724-done@debbugs.gnu.org; Thu, 06 Jun 2024 16:36:36 -0400 Original-Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfhigh.west.internal (Postfix) with ESMTP id C058C18001A6; Thu, 6 Jun 2024 16:36:14 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute7.internal (MEProxy); Thu, 06 Jun 2024 16:36:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1717706174; x=1717792574; bh=2mmKrATIDq5LMB8V3jTEVWCbD94g9d1DLF2NhVD5zHo=; b= bcPu8VVcUSQ7WP/c+jCa9C9DzQxS3Gz51RjIH6rz74JVGTCQYpOyd4/8L8qaxzJM NVFXMrYXfDUDrxHIehZxQ6xl6caaPwuUySG3Kp/xcwJkqu9G+3oOEle+vE8fBGb9 /XWu/5Bo5Ekyldv7+w8wBfnV3OCxnU/Fz5oKxq+NgR442M36uBctYNVZgU1cDSvp 7v0mmSWan1LxTaNqTtiRkyTdo8XMcr8oiXNYTW47X7YiQgxEXrJsMrOi7Ue5ajeu rnDksel9b8Hsq0TXTedP46EZrL1nB+quhPezwGjJicGV1ywObdunNWSC8CzmI6JZ L7o8YrHLVNLzTtA6TK7sAg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1717706174; x= 1717792574; bh=2mmKrATIDq5LMB8V3jTEVWCbD94g9d1DLF2NhVD5zHo=; b=C a3RyjCyWT1qo8wBTBfJ9zgMtHHFm/YYNo6jN/9VnmY8CCFTHhDO5YMd+E5qou9UX qKcNrr7YtcI60Ng6Alkh/rq0ryXZoY4iOeTHGNvKSQ7nwSkxIPl9yhlx8L0zcB9d wsmRchUjvKsNF0RYLKb+PAGrwK8/s0R96u+BVbsYoiY5ajJlOD+eoRzt2AC9zSCb iYT3bndManX0xDnG0FCEOnc4w3z0VrWXQk0/by862nwi2I20hkLiF3cQcea0cvY0 gzUyVQ+co8UP0BF+5eZ7RlApZyivyjr7FA7QJm8wiU41Qp4GMTVs/GLTtFBVMAe5 vKf5HBb2ImfdAm8AY9CQg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvdelkedgudehtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuhffvvehfjggtgfesthekredttddvjeenucfhrhhomhepffhm ihhtrhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrg htthgvrhhnpedvleeijeevkeejleffgeduiedujeffhfevudduffdvveetkeegveffjefg ffelueenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpe gumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 6 Jun 2024 16:36:12 -0400 (EDT) Content-Language: en-US In-Reply-To: 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:286721 Archived-At: On 04/05/2024 04:09, Dmitry Gutov wrote: > > I think I like this solution (as long as the nil value returned by > project-current on this step is appropriately handled). > > Something like: > > diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el > index 6896baf30ce..7b2461c3ce6 100644 > --- a/lisp/progmodes/eglot.el > +++ b/lisp/progmodes/eglot.el > @@ -1426,11 +1426,15 @@ eglot-reconnect >    (interactive (list (eglot--current-server-or-lose) t)) >    (when (jsonrpc-running-p server) >      (ignore-errors (eglot-shutdown server interactive nil > 'preserve-buffers))) > -  (eglot--connect (eglot--major-modes server) > -                  (eglot--project server) > -                  (eieio-object-class-name server) > -                  (eglot--saved-initargs server) > -                  (eglot--language-ids server)) > +  (let* ((root (project-root (eglot--project server))) > +         (project (project-current nil root))) > +    (if (not project) > +        (eglot--error "Project in `%s' is gone!" root) > +      (eglot--connect (eglot--major-modes server) > +                      project > +                      (eieio-object-class-name server) > +                      (eglot--saved-initargs server) > +                      (eglot--language-ids server)))) >    (eglot--message "Reconnected!")) > >  (defvar eglot--managed-mode) ; forward decl Okay, I've pushed a slightly revised version of this patch now. It makes sense to me, even if some caching issues might remain in project backend(s). Spencer, please see if it takes care of your scenario.