From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#59001: Eglot activated in xref internal buffers Date: Thu, 03 Nov 2022 20:43:31 +0200 Organization: LINKOV.NET Message-ID: <86y1srri98.fsf_-_@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34569"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (x86_64-pc-linux-gnu) Cc: dmitry gutov To: 59001@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Nov 03 19:51:00 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 1oqfIq-0008nm-KF for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Nov 2022 19:51:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqfHx-00008D-81; Thu, 03 Nov 2022 14:50:05 -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 1oqfHv-00006H-7j for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2022 14:50:03 -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 1oqfHu-0008Bs-TG for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2022 14:50:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oqfHu-0003wI-NI; Thu, 03 Nov 2022 14:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: dgutov@yandex.ru, bug-gnu-emacs@gnu.org Resent-Date: Thu, 03 Nov 2022 18:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 59001 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: dmitry gutov Original-Received: via spool by submit@debbugs.gnu.org id=B.166750136915091 (code B ref -1); Thu, 03 Nov 2022 18:50:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 3 Nov 2022 18:49:29 +0000 Original-Received: from localhost ([127.0.0.1]:50671 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqfHN-0003vL-Eg for submit@debbugs.gnu.org; Thu, 03 Nov 2022 14:49:29 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34004) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqfHJ-0003vA-Fe for submit@debbugs.gnu.org; Thu, 03 Nov 2022 14:49:27 -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 1oqfGi-00087E-7e for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2022 14:49:12 -0400 Original-Received: from relay8-d.mail.gandi.net ([2001:4b98:dc4:8::228]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqfGd-0007vW-KU for bug-gnu-emacs@gnu.org; Thu, 03 Nov 2022 14:48:46 -0400 Original-Received: (Authenticated sender: juri@linkov.net) by mail.gandi.net (Postfix) with ESMTPSA id EEA941BF205 for ; Thu, 3 Nov 2022 18:48:39 +0000 (UTC) Received-SPF: pass client-ip=2001:4b98:dc4:8::228; envelope-from=juri@linkov.net; helo=relay8-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:247020 Archived-At: X-Debbugs-Cc: João Távora X-Debbugs-Cc: Dmitry Gutov [A new issue spun off from bug#58839] > 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. This issue is very hard to reproduce. It occurs only when *xref-temp* first sets one mode not eglot-managed, then afterwards enables another mode that is eglot-managed in the same internal buffer. Maybe Dmitry could explain what is going wrong. > 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))))