Subject: bug#72765: Eglot + Clangd + Company + non-empty suffix = duplicate text

From: João Távora <[email-masked]>
Date: Sun, 8 Sep 2024 16:51:37 +0100

On Sun, Sep 8, 2024 at 3:41 AM Dmitry Gutov <[email-masked]> wrote:
>
> On 03/09/2024 16:43, João Távora wrote:
> > On Tue, Sep 3, 2024 at 2:20 PM Dmitry Gutov<[email-masked]>  wrote:
> >> On 01/09/2024 17:28, Dmitry Gutov wrote:
> >>>> * the rust-analyzer test you added recently -- and which you said was
> >>>>     very brittle -- is indeed very brittle: I cannot get it to pass.  We
> >>>>     should fix it, or just delete it and do those rust-analyzer tests
> >>>>     manually each time we touch this area.
> >>> Could you give more details? It is indeed more brittle in theory, but on
> >>> my machine it's passing every time.
> >> Yeah, I see it now - it succeeds in an interactive session and fails in
> >> batch mode. Not sure it was the same when the patch was committed
> >> (hopefully not).
> >>
> >> Might be due to window configuration being different...
> > Yes, I was trying batch mode.  make -C test eglot-tests  or something
> > similar.  Please fix it or delete it (or disable it).
>
> Looking at minibuffer-tests.el, the above might be a solution, but it
> gets me a core dump instead:
>
> diff --git a/test/lisp/progmodes/eglot-tests.el
> b/test/lisp/progmodes/eglot-tests.el
> index e0168baee54..fa3b63b38dc 100644
> --- a/test/lisp/progmodes/eglot-tests.el
> +++ b/test/lisp/progmodes/eglot-tests.el
> @@ -711,7 +711,8 @@ eglot-test-rust-completion-exit-function
>         (search-forward "v.count_on")
>         (let ((minibuffer-message-timeout 0)
>               ;; Fail at (ding) if completion fails.
> -            (executing-kbd-macro t))
> +            (executing-kbd-macro t)
> +            (redisplay-skip-initial-frame nil))
>           (when (buffer-live-p "*Completions*")
>             (kill-buffer "*Completions*"))
>           ;; The design is pretty brittle, we'll need to monitor the
>
>
> Will follow up later if nobody beats me to it (can others reproduce the
> crash?)

This now aborts (segfault?).  At least something different.

So, for the record, before this patch with the latest emacs-30, I get the
results in failure1.txt and with your last redisplay-skip-initial-frame patch
I get failure2.txt.

I've produced these files with

make -C test eglot-tests SELECTOR=\"rust-completion\" 2>&1 | tee failure1.txt
make -C test eglot-tests SELECTOR=\"rust-completion\" 2>&1 | tee failure2.txt

$ rust-analyzer --version
rust-analyzer 1 (0f7f68dad2 2024-08-27)

$ src/emacs --version
GNU Emacs 30.0.90
Development version 89c99891b2b3 on emacs-30 branch; build date 2024-09-08.
Copyright (C) 2024 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.