Subject: bug#73414: closed (Re: bug#73414: eglot: using auto-revert-mode and git checkout corrupts diagn)

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 26 Sep 2024 15:45:02 +0000

Your bug report

#73414: eglot: using auto-revert-mode and git checkout corrupts diagnostics

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
73414: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73414
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#73414: eglot: using auto-revert-mode and git checkout corrupts diagn
From: Eli Zaretskii <[email-masked]>
To: Romain Ouabdelkader <[email-masked]>
Cc: [email-masked]
Date: Thu, 26 Sep 2024 18:44:14 +0300
List-Id: <debbugs-submit.debbugs.gnu.org>

> From: Romain Ouabdelkader <[email-masked]>
> Date: Thu, 26 Sep 2024 17:06:08 +0200
> 
> It seems the issue got fixed by commit 29d50e245f84d62a9cf4ce00593ea4c63fc4f44d, I can't reproduce the
> issue with this patch installed.
> You can close the issue (not sure if I can?)

Thanks, closing (you can also).

Subject: eglot: using auto-revert-mode and git checkout corrupts diagnostics
From: Romain Ouabdelkader <[email-masked]>
To: [email-masked]
Date: Sat, 21 Sep 2024 21:13:35 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello,

With auto-revert-mode and eglot enabled, using a git checkout to change
branch will leave invalid buffer diagnostics.

Emacs version: GNU Emacs 30.0.91
Operating system: Mac OS X
Eglot version: reproduced with emacs -Q on emacs30 pretest.
Server used: pyright

Steps to reproduce:

Using the following file:

```
def print_lorem_ipsum():
    print("Lorem ipsum dolor sit amet, consectetur adipiscing elit.")

def print_lorem_ipsum_upper():
    print("LOREM IPSUM DOLOR SIT AMET, CONSECTETUR ADIPISCING ELIT.")
```

1. Initialize the git repository:

$ git init
$ git add a.py
$ git commit

$ git checkout -b test
# edit a.py and remove the function print_lorem_ipsum_upper
$ git add a.py
$ git commit

2. Start emacs on the test branch:

$ emacs -Q a.py
M-x auto-revert-mode
M-x eglot

3. Then go to the main branch:

$ git checkout main

After auto-revert-mode triggers a file reload, eglot will report that the
function print_lorem_ipsum_upper is duplicated. (See screenshot in
attachment)
See also the `eglot-events-buffer` logs in attachment.

In this state, even if you delete the function and rewrite it, the error
will stay.
The only way to fix the issue is to do a eglot-reconnect.

I can reproduce the issue on emacs30 with built-in eglot and I didn't have
the problem on emacs29 with eglot 1.15 from ELPA.

Thanks.