all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: 59001@debbugs.gnu.org
Cc: dmitry gutov <dgutov@yandex.ru>
Subject: bug#59001: Eglot activated in xref internal buffers
Date: Thu, 03 Nov 2022 20:43:31 +0200	[thread overview]
Message-ID: <86y1srri98.fsf_-_@mail.linkov.net> (raw)

X-Debbugs-Cc: João Távora <joaotavora@gmail.com>
X-Debbugs-Cc: Dmitry Gutov <dgutov@yandex.ru>

[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 <juri@linkov.net> 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(#<buffer  *xref-temp*>)
>>   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))))





             reply	other threads:[~2022-11-03 18:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 18:43 Juri Linkov [this message]
2022-11-04  0:50 ` bug#59001: Eglot activated in xref internal buffers Dmitry Gutov
2022-11-04  7:29   ` bug#59001: Eglot activated in Xref " Juri Linkov
2022-11-04 10:52     ` Dmitry Gutov

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86y1srri98.fsf_-_@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=59001@debbugs.gnu.org \
    --cc=dgutov@yandex.ru \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.