bug#81538: 32.0.50; Eglot: Non-local exit during window/showDocument handling

Troy Brown via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <[email protected]>
Newsgroups gmane.emacs.bugs
Message-ID <CABvCZ439pNg6FR+7VydDVa8NufwnJi+Kv-xNo4rqxF=G62aUgg@mail.gmail.com>
On Sun, Aug 9, 2026 at 10:28 AM João Távora <[email protected]> wrote:
>
> This patch won't work, don't bother, but the one after my signature
> will.
>
> The reason I know is that I tested myself:

Yeah, I had noticed that `eglot-handle-request` runs in a temporary
buffer, so the locally registered post command hook was not being
executed.

>
>     git clone https://github.com/brownts/ada-ts-mode.git
>     cd ada-ts-mode
>     curl -LO https://github.com/AdaCore/ada_language_server/releases/download/2026.3.202607051/als-2026.3.202607051-linux-x64.tar.gz
>     tar xvfz als-2026.3.202607051-linux-x64.tar.gz
>     PATH=$PATH:$PWD/integration/vscode/ada/x64/linux /path/to/emacs -Q -L . \
>         -l ada-ts-mode -l ada-ts-lspclient-eglot                            \
>         test/resources/hello_world/hello_world.ads -f eglot
>     C-c C-o
>
> (This, btw, is what a MRE should look like for future bug reports.  It
> relieves me from wading through this stuff and lets me focus on the problem.)
>
> However, in my machine I couldn't reproduce the problem.  C-c C-o works
> fine regardless of the size of the file.  What exactly is the breakage
> I'm looking for?

When the problem happens, I notice that font-lock-mode is not enabled
in the buffer and the buffer is not actually displayed...it stays
buried.

> Can you supply an incantation similar to the one above
> that is guaranteed (or almost guaranteed) to fail?

Try this.  The bug branch has larger files where I originally ran
across the problem.  I also noticed that waiting for the LSP
initialization to complete seems to increase the odds of the command
failing (hence the "sleep-for" below).  The following works for me
most of the time.

git switch bug/81538
~/repos/emacs.git/master/src/emacs -Q -L . -l ada-ts-mode -l
ada-ts-lspclient-eglot test/resources/als-other-file/gtkada-mdi.adb
--eval '(progn (eglot-ensure) (sleep-for 5))'
C-c C-o

> +                  (run-at-time #'findit 0 nil))))

I'll try the new patch out.  FYI, I had also noticed that the call to
"run-at-time" has parameters in the wrong order.  It should be
`(run-at-time 0 nil #'findit)`.


Troy.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.