GNU bug report logs - #79698
30.2; Wrong snippet indentation with rust-analyzer

Previous Next

Package: emacs;

Reported by: chinmay <dalal.chinmay.0101 <at> gmail.com>

Date: Sun, 26 Oct 2025 05:26:02 UTC

Severity: normal

Found in version 30.2

Done: Eli Zaretskii <eliz <at> gnu.org>

To reply to this bug, email your comments to 79698 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#79698; Package emacs. (Sun, 26 Oct 2025 05:26:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to chinmay <dalal.chinmay.0101 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 26 Oct 2025 05:26:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: chinmay <dalal.chinmay.0101 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.2; Wrong snippet indentation with rust-analyzer
Date: Sun, 26 Oct 2025 01:25:29 -0400
[Message part 1 (text/plain, inline)]
Originally reported at https://github.com/joaotavora/eglot/issues/1549,
but the README indicates that github is not the place anymore.
Steps to reproduce:
1) install the rust tree-sitter parser using distro package, and rust-analyzer+cargo with rustup: `rustup component add cargo rust-analyzer`
2) `cd $(mktemp --directory --tmpdir=/tmp tmp.XXXXXX)`
3) `cargo new foo`
4) `emacs -Q --init-directory .`
5) `M-x package-refresh-contents  RET`
6) `M-x package-install RET yasnippet RET`
7) `M-x eglot-upgrade-eglot  RET`
8) `C-x C-f foo/src/main.rs`
9) `M-x rust-ts-mode RET`
10) `M-x eglot RET`
11) on the second line, type `whi`, do `M-x completion-at-point RET`,
choose `while` using `M-<down>` and `M-RET`

Expected behavior (`|` represents the first placeholder, where the
cursor is placed automatically. `||` represents the second placeholder):
    while | {
        ||
    }
Actual behavior:
    while | {
        ||
        }
Attached: the contents of eglot-events-buffer and a screenshot
[eglot-events-buffer.txt (text/plain, attachment)]
[eglot-snippet.png (image/png, attachment)]
[Message part 4 (text/plain, inline)]


In GNU Emacs 30.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.50,
cairo version 1.18.4)
Windowing system distributor 'The X.Org Foundation', version 11.0.12401008
System Description: Arch Linux

Configured using:
 'configure --with-x-toolkit=gtk3 --sysconfdir=/etc --prefix=/usr
 --libexecdir=/usr/lib --localstatedir=/var --disable-build-details
 --with-cairo --with-harfbuzz --with-libsystemd --with-modules
 --with-native-compilation=aot --with-tree-sitter
 'CFLAGS=-march=x86-64-v4 -O3 -pipe -fno-plt -fexceptions
 -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security
 -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer
 -mno-omit-leaf-frame-pointer -mpclmul -g
 -ffile-prefix-map=/startdir/src=/usr/src/debug/emacs -flto=auto
 -falign-functions=32' 'LDFLAGS=-Wl,-O1 -Wl,--sort-common
 -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs
 -flto=auto -falign-functions=32''

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_IN.UTF-8
  value of $XMODIFIERS: @im=fcitx
  locale-coding-system: utf-8-unix

Major mode: Rust

Minor modes in effect:
  eglot-inlay-hints-mode: t
  eglot--managed-mode: t
  flymake-mode: t
  yas-minor-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/tmp/tmp.fzb0Qw/elpa/jsonrpc-1.0.26/jsonrpc hides /usr/share/emacs/30.2/lisp/jsonrpc
/tmp/tmp.fzb0Qw/elpa/flymake-1.4.2/flymake hides /usr/share/emacs/30.2/lisp/progmodes/flymake
/tmp/tmp.fzb0Qw/elpa/eglot-1.19/eglot hides /usr/share/emacs/30.2/lisp/progmodes/eglot

Features:
(shadow sort mail-extr emacsbug rust-ts-mode c-ts-common vc-git
vc-dispatcher eglot-autoloads tree-widget info flymake-autoloads
jsonrpc-autoloads comp comp-cstr eglot external-completion jsonrpc xref
flymake project compat diff diff-mode track-changes filenotify imenu
ox-odt rng-loc rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn
nxml-parse nxml-ns nxml-enc xmltok nxml-util ox-latex ox-icalendar
org-agenda ox-html table ox-ascii ox-publish ox org-attach org-element
org-persist xdg org-id org-refile org-element-ast inline avl-tree
generator org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src sh-script smie treesit executable ob-comint org-pcomplete
pcomplete org-list org-footnote org-faces org-entities noutline outline
org-version ob-emacs-lisp ob-core ob-eval org-cycle org-table ol
org-fold org-fold-core org-keys oc org-loaddefs thingatpt cal-menu
calendar cal-loaddefs org-compat org-macs format-spec ert-x ert ewoc
warnings edebug debug backtrace find-func color yasnippet pcase cl-extra
help-mode yasnippet-autoloads easy-mmode loaddefs-gen lisp-mnt
radix-tree tar-mode arc-mode archive-mode cus-edit pp cus-start cus-load
wid-edit finder-inf mm-archive message sendmail yank-media dired
dired-loaddefs rfc822 mml mml-sec epa derived gnus-util time-date
mailabbrev gmm-utils mailheader mm-decode mm-bodies mm-encode mail-utils
gnutls network-stream url-cache url-http url-auth mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm puny compile
text-property-search comint ansi-osc ansi-color ring comp-run
comp-common rx epg rfc6068 epg-config package browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs icons password-cache json
subr-x map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib
rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt
fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode
register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo gtk x-toolkit xinput2 x multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 439115 68416) (symbols 48 28719 45)
 (strings 32 104746 3816) (string-bytes 1 3249301) (vectors 16 49953)
 (vector-slots 8 578478 37561) (floats 8 307 99)
 (intervals 56 1159 80) (buffers 992 24))

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79698; Package emacs. (Sun, 26 Oct 2025 07:20:01 GMT) Full text and rfc822 format available.

Message #8 received at 79698 <at> debbugs.gnu.org (full text, mbox):

From: Chinmay Dalal <dalal.chinmay.0101 <at> gmail.com>
To: 79698 <at> debbugs.gnu.org
Subject: bug#79698: 30.2; Eglot - Wrong snippet indentation with rust-analyzer
Date: Sun, 26 Oct 2025 03:19:30 -0400
Sorry, forgot to mention eglot in the subject in the original email




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79698; Package emacs. (Mon, 27 Oct 2025 13:21:03 GMT) Full text and rfc822 format available.

Message #11 received at 79698 <at> debbugs.gnu.org (full text, mbox):

From: Lua Viana Reis <me <at> lua.blog.br>
To: 79698 <at> debbugs.gnu.org, dalal.chinmay.0101 <at> gmail.com
Subject: bug#79698: 30.2; Eglot - Wrong snippet indentation with rust-analyzer
Date: Mon, 27 Oct 2025 13:20:06 +0000 (UTC)
Try setting `yas-indent-line` to 'fixed in your config. By default, 
yasnippet attempts to indent the lines according to the mode, and if you 
use `indent-region` you will see that the result is the same when there 
is no text between the "while" keyword and the "{ }" block.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79698; Package emacs. (Mon, 27 Oct 2025 14:02:02 GMT) Full text and rfc822 format available.

Message #14 received at 79698 <at> debbugs.gnu.org (full text, mbox):

From: Chinmay Dalal <dalal.chinmay.0101 <at> gmail.com>
To: me <at> lua.blog.br,79698 <at> debbugs.gnu.org
Subject: bug#79698: 30.2; Eglot - Wrong snippet indentation with rust-analyzer
Date: Mon, 27 Oct 2025 10:00:59 -0400
Thanks, that works




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79698; Package emacs. (Mon, 27 Oct 2025 15:15:01 GMT) Full text and rfc822 format available.

Message #17 received at 79698 <at> debbugs.gnu.org (full text, mbox):

From: Chinmay Dalal <dalal.chinmay.0101 <at> gmail.com>
To: dalal.chinmay.0101 <at> gmail.com,79698 <at> debbugs.gnu.org
Subject: bug#79698: 30.2; Eglot - Wrong snippet indentation with rust-analyzer
Date: Mon, 27 Oct 2025 11:10:22 -0400
Should I maintain a hook for rust-ts-mode setting this in my config?
Is this considered a bug in the major mode? Or should eglot maintain a
list of major modes which need this setting?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79698; Package emacs. (Sat, 01 Nov 2025 09:13:02 GMT) Full text and rfc822 format available.

Message #20 received at 79698 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: chinmay <dalal.chinmay.0101 <at> gmail.com>, Randy Taylor <dev <at> rjt.dev>
Cc: 79698 <at> debbugs.gnu.org
Subject: Re: bug#79698: 30.2; Wrong snippet indentation with rust-analyzer
Date: Sat, 01 Nov 2025 11:12:03 +0200
> From: chinmay <dalal.chinmay.0101 <at> gmail.com>
> Date: Sun, 26 Oct 2025 01:25:29 -0400
> 
> Originally reported at https://github.com/joaotavora/eglot/issues/1549,
> but the README indicates that github is not the place anymore.
> Steps to reproduce:
> 1) install the rust tree-sitter parser using distro package, and rust-analyzer+cargo with rustup: `rustup component add cargo rust-analyzer`
> 2) `cd $(mktemp --directory --tmpdir=/tmp tmp.XXXXXX)`
> 3) `cargo new foo`
> 4) `emacs -Q --init-directory .`
> 5) `M-x package-refresh-contents  RET`
> 6) `M-x package-install RET yasnippet RET`
> 7) `M-x eglot-upgrade-eglot  RET`
> 8) `C-x C-f foo/src/main.rs`
> 9) `M-x rust-ts-mode RET`
> 10) `M-x eglot RET`
> 11) on the second line, type `whi`, do `M-x completion-at-point RET`,
> choose `while` using `M-<down>` and `M-RET`
> 
> Expected behavior (`|` represents the first placeholder, where the
> cursor is placed automatically. `||` represents the second placeholder):
>     while | {
>         ||
>     }
> Actual behavior:
>     while | {
>         ||
>         }
> Attached: the contents of eglot-events-buffer and a screenshot

Thanks.

Randy, any comments or suggestions?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79698; Package emacs. (Sat, 01 Nov 2025 09:17:02 GMT) Full text and rfc822 format available.

Message #23 received at 79698 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Chinmay Dalal <dalal.chinmay.0101 <at> gmail.com>,
 João Távora <joaotavora <at> gmail.com>
Cc: me <at> lua.blog.br, 79698 <at> debbugs.gnu.org
Subject: Re: bug#79698: 30.2;
 Eglot - Wrong snippet indentation with rust-analyzer
Date: Sat, 01 Nov 2025 11:16:10 +0200
> From: Chinmay Dalal <dalal.chinmay.0101 <at> gmail.com>
> Date: Mon, 27 Oct 2025 10:00:59 -0400
> 
> Thanks, that works

João, is it okay to close this bug?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#79698; Package emacs. (Sat, 01 Nov 2025 17:40:01 GMT) Full text and rfc822 format available.

Message #26 received at 79698 <at> debbugs.gnu.org (full text, mbox):

From: João Távora <joaotavora <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 79698 <at> debbugs.gnu.org, Chinmay Dalal <dalal.chinmay.0101 <at> gmail.com>,
 "Lua V. R." <me <at> lua.blog.br>
Subject: Re: bug#79698: 30.2;
 Eglot - Wrong snippet indentation with rust-analyzer
Date: Sat, 1 Nov 2025 17:39:33 +0000
[Message part 1 (text/plain, inline)]
Yes, I've had a read and I think so

João Távora

On Sat, Nov 1, 2025, 09:16 Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Chinmay Dalal <dalal.chinmay.0101 <at> gmail.com>
> > Date: Mon, 27 Oct 2025 10:00:59 -0400
> >
> > Thanks, that works
>
> João, is it okay to close this bug?
>
[Message part 2 (text/html, inline)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 01 Nov 2025 17:47:01 GMT) Full text and rfc822 format available.

Notification sent to chinmay <dalal.chinmay.0101 <at> gmail.com>:
bug acknowledged by developer. (Sat, 01 Nov 2025 17:47:02 GMT) Full text and rfc822 format available.

Message #31 received at 79698-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: João Távora <joaotavora <at> gmail.com>
Cc: dalal.chinmay.0101 <at> gmail.com, me <at> lua.blog.br, 79698-done <at> debbugs.gnu.org
Subject: Re: bug#79698: 30.2;
 Eglot - Wrong snippet indentation with rust-analyzer
Date: Sat, 01 Nov 2025 19:46:07 +0200
> From: João Távora <joaotavora <at> gmail.com>
> Date: Sat, 1 Nov 2025 17:39:33 +0000
> Cc: Chinmay Dalal <dalal.chinmay.0101 <at> gmail.com>, "Lua V. R." <me <at> lua.blog.br>, 79698 <at> debbugs.gnu.org
> 
> Yes, I've had a read and I think so

Thanks, closing.




This bug report was last modified 4 days ago.

Previous Next


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