From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#58839: [Patch] Re: bug#58839: 29.0.50; project-kill-buffer fails when Eglot is running Date: Thu, 3 Nov 2022 18:19:20 +0000 Message-ID: References: <87sfj8umwb.fsf@posteo.net> <87ilk2x1si.fsf@gmail.com> <871qqq7l9p.fsf@posteo.net> <87eduqwekz.fsf@gmail.com> <87wn8invbx.fsf@posteo.net> <877d0iw8iq.fsf@gmail.com> <837d0hhlke.fsf@gnu.org> <46ff0065-5645-ef1e-2621-242fb6a73f98@yandex.ru> <87v8o0uxn5.fsf@gmail.com> <787a4362-7ff5-7dbb-9118-16e4bee5f328@yandex.ru> <87edunvhf2.fsf@gmail.com> <6d4d9e72-1bae-4d64-b7c1-c2b9c11e396f@yandex.ru> <6c9811d7-ad05-2d2d-0c34-9b4c1fa09305@yandex.ru> <87a659u7vo.fsf@gmail.com> <8735b1bvnz.fsf@posteo.net> <87mt99spsk.fsf@gmail.com> <87r0ylafdl.fsf@posteo.net> <87cza5sbfx.fsf@gmail.com> <87r0ylh0y4.fsf@posteo.net> <86mt991dst.fsf@mail.linkov.net> <86o7tojda2.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c0e51605ec94ffb8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33486"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58839@debbugs.gnu.org, Dmitry Gutov To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 03 19:20:11 2022 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 1oqep1-0008Wc-AS for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Nov 2022 19:20:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqeow-0006ic-Ll; Thu, 03 Nov 2022 14:20:06 -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 1oqeou-0006fy-3u for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2022 14:20:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oqeos-00031S-Mo for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2022 14:20:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oqeos-0000rR-J6 for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2022 14:20:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Nov 2022 18:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58839 X-GNU-PR-Package: emacs Original-Received: via spool by 58839-submit@debbugs.gnu.org id=B58839.16674995823276 (code B ref 58839); Thu, 03 Nov 2022 18:20:02 +0000 Original-Received: (at 58839) by debbugs.gnu.org; 3 Nov 2022 18:19:42 +0000 Original-Received: from localhost ([127.0.0.1]:50604 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqeoY-0000qm-4M for submit@debbugs.gnu.org; Thu, 03 Nov 2022 14:19:42 -0400 Original-Received: from mail-oi1-f174.google.com ([209.85.167.174]:40499) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqeoW-0000qY-J1 for 58839@debbugs.gnu.org; Thu, 03 Nov 2022 14:19:41 -0400 Original-Received: by mail-oi1-f174.google.com with SMTP id n186so2850244oih.7 for <58839@debbugs.gnu.org>; Thu, 03 Nov 2022 11:19:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=BeArjrfNkZ4KeKSKpmyOSlIkMTPAGlJ/i67Abk1sjxo=; b=fqHyvmAJdUvbI4PTK8oNqLySC6ltK4gkA7T+Z2Xi1PmJd1PU9feP6FF0pdQ9F76S9c 5vBkKb0+pBGN69nwk+RPUSi3AkMaQ6p/mCxOJ3XNOJ5hpFVSNHfPLBv4GoXzK4F6zH9O oTUsbVRICMoPfinx0lDnBFb0aEqI4A5/sJgN5A3lXX0q+0+IvBCcBCihIw2KoVvn7C7M UU38AK7cejvYr/KbQkoHJCMLk6uvFdVRaNy/9UmuEDJj/5elGv8gPUEJ6gxbgITVPK0D LS1pSayPkx24xENIZh60/O6lovho4HD1MxaOkThifHET+G5P7LKxHV9v5pRSOKaQmh0P LtJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=BeArjrfNkZ4KeKSKpmyOSlIkMTPAGlJ/i67Abk1sjxo=; b=DcHfUYverjSDr8sN0pZRWj+TrTs3ESlkWOQpQuVtBpXhCxVIc9SI3iX3QV69tlS+B6 GS/PsbW1h4T9wsZPwaO3jfdpl2C+QboAvoOPVeGgr9s0ZafnR/MCMffHbWiz0yw9hxIq eTe+WUeq/oIi2ze9fppT+SLXcDW3H7BLz1tVBzG+njJjQH73svqO0+E9O/44wIijHzbv SVWOAjRG1x2oBTY6U+6heZlBqNDVA83r/a/aggkQRJeRHbUADwMfsJrDfZtDnvfCvHlD KZ3VIxUNgZZlKp38nhnfiEKH4bY62Y9BjeRIhtX5DrSOH9Uh2MvwO17eRs3+EOGuA9NI dXHA== X-Gm-Message-State: ACrzQf0hU8J44OeAlFxHDcecsOgjKIMtdT0eT3bZAz6USgXXJewMe3ri EZezjX/15APWSEWzZrmkVB/yX5/SOInBTCGrzDE= X-Google-Smtp-Source: AMsMyM6Xp1I6f/kK7AXaixelsiXpFK183sib/waUIHgyILLSqcfnyJn/gJUG+J9MCg/Qbqs4zB+OktK8s0XROqO3aS8= X-Received: by 2002:a05:6808:a05:b0:35a:2a65:eb01 with SMTP id n5-20020a0568080a0500b0035a2a65eb01mr8552965oij.215.1667499573698; Thu, 03 Nov 2022 11:19:33 -0700 (PDT) In-Reply-To: <86o7tojda2.fsf@mail.linkov.net> 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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247008 Archived-At: --000000000000c0e51605ec94ffb8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Juri, this doesn't seem right. Eglot shouldn't be turning itself on in hidden buffers to start with: It's totally useless there. So you have to explain an Emacs -Q recipe that demonstrates how Eglot reached this nonsensical state. You haven't done that (or have you and i have missed it?). I tried project-find-regexp with Eglot-managed files with no problems, but I have no idea what you're doing. Also, this problem is totally off-topic here: this is about project-kill-buffers. Please start as new issue of you haven't already. Jo=C3=A3o On Thu, Nov 3, 2022, 17:39 Juri Linkov wrote: > > OTOH I completely support the request to make Eglot more resilient > > to unforeseeable situations. Currently it's so brittle, so I get a lot > > of such errors all the time: > > > > Debugger entered--Lisp error: (wrong-type-argument arrayp nil) > > file-truename(nil) > > eglot--path-to-uri(nil) > > eglot--TextDocumentIdentifier() > > eglot--signal-textDocument/didClose() > > kill-buffer(#) > > xref--convert-hits(...) > > xref-matches-in-files("word" ...) > > project--find-regexp-in-files("word" ...) > > apply(project--find-regexp-in-files ("word" ...)) > > xref--show-xref-buffer(...) > > xref--show-xrefs(...) > > xref-show-xrefs(...) > > project-find-regexp("word") > > funcall-interactively(project-find-regexp "word") > > command-execute(project-find-regexp) > > Here's a patch that fixes this: > > diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el > index c5870618372..5b05f84c63c 100644 > --- a/lisp/progmodes/eglot.el > +++ b/lisp/progmodes/eglot.el > @@ -1792,7 +1792,9 @@ eglot--maybe-activate-editing-mode > (unless eglot--managed-mode > ;; Called when `revert-buffer-in-progress-p' is t but > ;; `revert-buffer-preserve-modes' is nil. > - (when (and buffer-file-name (eglot-current-server)) > + (when (and buffer-file-name > + (not (string-match-p "\\` " (buffer-name))) > + (eglot-current-server)) > (setq eglot--diagnostics nil) > (eglot--managed-mode) > (eglot--signal-textDocument/didOpen)))) > --000000000000c0e51605ec94ffb8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Juri, this doesn't seem right. Eglot shouldn't be= turning itself on in hidden buffers to start with: It's totally useles= s there.

So you have to explai= n an Emacs -Q recipe that demonstrates how Eglot reached this nonsensical s= tate. You haven't done that (or have you and i have missed it?).
<= div dir=3D"auto">
I tried project-find-regexp wi= th Eglot-managed files with no problems, but I have no idea what you're= doing.

Also, this probl= em is totally off-topic here: this is about project-kill-buffers. Please st= art as new issue of you haven't already.

Jo=C3=A3o

On Thu, Nov 3, 2022, 17:39 Juri Linkov = <juri@linkov.net> wrote:
> OTOH I completely support the reque= st to make Eglot more resilient
> to unforeseeable situations.=C2=A0 Currently it's so brittle, so I= get a lot
> of such errors all the time:
>
> Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
>=C2=A0 =C2=A0file-truename(nil)
>=C2=A0 =C2=A0eglot--path-to-uri(nil)
>=C2=A0 =C2=A0eglot--TextDocumentIdentifier()
>=C2=A0 =C2=A0eglot--signal-textDocument/didClose()
>=C2=A0 =C2=A0kill-buffer(#<buffer=C2=A0 *xref-temp*>)
>=C2=A0 =C2=A0xref--convert-hits(...)
>=C2=A0 =C2=A0xref-matches-in-files("word" ...)
>=C2=A0 =C2=A0project--find-regexp-in-files("word" ...)
>=C2=A0 =C2=A0apply(project--find-regexp-in-files ("word" ...)= )
>=C2=A0 =C2=A0xref--show-xref-buffer(...)
>=C2=A0 =C2=A0xref--show-xrefs(...)
>=C2=A0 =C2=A0xref-show-xrefs(...)
>=C2=A0 =C2=A0project-find-regexp("word")
>=C2=A0 =C2=A0funcall-interactively(project-find-regexp "word"= )
>=C2=A0 =C2=A0command-execute(project-find-regexp)

Here's a patch that fixes this:

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index c5870618372..5b05f84c63c 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1792,7 +1792,9 @@ eglot--maybe-activate-editing-mode
=C2=A0 =C2=A0(unless eglot--managed-mode
=C2=A0 =C2=A0 =C2=A0;; Called when `revert-buffer-in-progress-p' is t b= ut
=C2=A0 =C2=A0 =C2=A0;; `revert-buffer-preserve-modes' is nil.
-=C2=A0 =C2=A0 (when (and buffer-file-name (eglot-current-server))
+=C2=A0 =C2=A0 (when (and buffer-file-name
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(not (string-match-= p "\\` " (buffer-name)))
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(eglot-current-serv= er))
=C2=A0 =C2=A0 =C2=A0 =C2=A0(setq eglot--diagnostics nil)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(eglot--managed-mode)
=C2=A0 =C2=A0 =C2=A0 =C2=A0(eglot--signal-textDocument/didOpen))))
--000000000000c0e51605ec94ffb8--