GNU bug report logs - #78862
31.0.50; Eglot couldn't refresh Flymake diagnostics on Rust project

Previous Next

Package: emacs;

Reported by: Eason Huang <aqua0210 <at> foxmail.com>

Date: Sun, 22 Jun 2025 07:13:02 UTC

Severity: normal

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Eason Huang <aqua0210 <at> foxmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Spencer Baugh <sbaugh <at> janestreet.com>, 78862 <at> debbugs.gnu.org, João Távora <joaotavora <at> gmail.com>
Subject: bug#78862: 31.0.50; Eglot couldn't refresh Flymake diagnostics on Rust project
Date: Sun, 22 Jun 2025 19:27:56 +0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Eason Huang <aqua0210 <at> foxmail.com>
>> Date: Sun, 22 Jun 2025 15:05:06 +0800
>> 
>> Hello Emacs dev,
>> 
>> Recently, I found that if flymake-mode enabled before eglot,eglot can not
>> refresh the Flymake diagnostics.
>> Disable flymake with `M-x flymake-mode`, and then enable eglot
>> with `M-x eglot` can fix the issue. Or with the below snippet can fix
>> it:
>> 
>> ```
>> (with-eval-after-load 'eglot
>>     (add-hook 'eglot-managed-mode-hook (lambda ()
>>                                          (flymake-mode -1)
>>                                          (flymake-mode 1))))
>> 
>> ```
>> 
>> Steps to reproduce:
>> 
>> 1. put below config into the init.el file
>> ```
>> (use-package flymake
>>   :hook (prog-mode . flymake-mode))
>> 
>> (use-package rust-mode
>>   :ensure t
>>   :defer t
>>   :custom (rust-mode-treesitter-derive (and (fboundp 'treesit-available-p)
>>                                             (treesit-available-p))))
>> ```
>> 2. Start Emacs 31
>> 3. Open any Rust project with a dependency
>> 4. Open any Rust file in a rust project(make sure it use a dependency),
>> such as main.rs, then flymake will report errors. Because I don't have
>> flymake rust backends,the errors is expected.
>>   
>> 5. Make sure `rust-analyzer` is in the PATH,My rust toolchain is as
>> below:
>> 
>> ```
>> rustc --version
>> rustc 1.87.0 (17067e9ac 2025-05-09)
>> 
>> rust-analyzer --version
>> rust-analyzer 1.87.0 (17067e9ac6d 2025-05-09)
>> ``
>> 6. Start eglot with `M-x eglot`, now the errors still exist. This is the
>> issue.
>> 
>> 7. `M-x flymake-mode` to disable flymake
>> 8. `M-x eglot-reconnect` will refresh the Flymake diagnostics,and no
>> errors reported if your Rust project is compiled.
>> 
>> 
>> The issue only happened on Emacs 31, it works as expected on Emacs 30.  
>
> Thanks, I hope João and Spencer will have comments or suggestions
> about this.
>

>
>

Hello Eli, João and Spencer,

I find out that it is related to `rust-ts-flymake-command`, when
customize it's value to `'("cargo" "clippy")`, it works as expected.

It works with below rust config:

```
(use-package rust-mode
  :defer t
  :custom
  (rust-mode-treesitter-derive (and (fboundp 'treesit-available-p)
                                    (treesit-available-p)))
  (rust-ts-flymake-command '("cargo" "clippy")))

```

May be this information help.

-- 
Eason Huang





This bug report was last modified 8 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.