Package: emacs;
Reported by: Roi Martin <jroi.martin <at> gmail.com>
Date: Sat, 4 Jan 2025 17:47:02 UTC
Severity: normal
Found in version 29.4
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
View this message in rfc822 format
From: help-debbugs <at> gnu.org (GNU bug Tracking System) To: Yuan Fu <casouri <at> gmail.com> Cc: tracker <at> debbugs.gnu.org Subject: bug#75362: closed (29.4; go-ts-mode.el: wrong indentation inside var list) Date: Mon, 13 Jan 2025 06:36:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Sun, 12 Jan 2025 22:35:35 -0800 with message-id <877E7FAB-CA09-48E6-AD66-DE0C025E2F0E <at> gmail.com> and subject line Re: bug#75362: 29.4; go-ts-mode.el: wrong indentation inside var list has caused the debbugs.gnu.org bug report #75362, regarding 29.4; go-ts-mode.el: wrong indentation inside var list to be marked as done. (If you believe you have received this mail in error, please contact help-debbugs <at> gnu.org.) -- 75362: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75362 GNU Bug Tracking System Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Roi Martin <jroi.martin <at> gmail.com> To: bug-gnu-emacs <at> gnu.org Subject: 29.4; go-ts-mode.el: wrong indentation inside var list Date: Sat, 04 Jan 2025 16:40:18 +0100When using the Go tree-sitter grammar v0.23.4 from https://github.com/tree-sitter/tree-sitter-go.git, indentation inside var lists does not work correctly. For instance, the following code is indented as: ``` var ( one = 1 ) ``` Instead of: ``` var ( one = 1 ) ``` Just in case it can help, I think this stopped working with grammar version `v0.21.1`, that introduced `var_spec_list`: https://github.com/tree-sitter/tree-sitter-go/compare/v0.21.0...v0.21.1 Please, take it with a pinch of salt because I'm not very familiar with tree-sitter. In GNU Emacs 29.4 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.0) of 2024-10-10 built on 4825182c94fc4195b65c80c30f523a16 System Description: Fedora Linux 41 (Workstation Edition) Configured using: 'configure --build=x86_64-redhat-linux-gnu --host=x86_64-redhat-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/libexec --localstatedir=/var --runstatedir=/run --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-cairo --with-dbus --with-gif --with-gpm=no --with-harfbuzz --with-jpeg --with-json --with-modules --with-native-compilation=aot --with-pgtk --with-png --with-rsvg --with-sqlite3 --with-tiff --with-tree-sitter --with-webp --with-xpm build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer ' 'LDFLAGS=-Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes ' PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig CXX=g++ 'CXXFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer '' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB Important settings: value of $LC_MONETARY: en_IE.UTF-8 value of $LC_NUMERIC: en_IE.UTF-8 value of $LC_TIME: en_IE.UTF-8 value of $LANG: en_US.UTF-8 value of $XMODIFIERS: @im=ibus locale-coding-system: utf-8-unix Major mode: Go Minor modes in effect: eglot--managed-mode: t flymake-mode: t denote-menu-bar-mode: t server-mode: t icomplete-mode: t fido-mode: t tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t column-number-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: /home/n/.emacs.d/elpa/transient-20250103.1731/transient hides /usr/share/emacs/29.4/lisp/transient Features: (shadow sort mail-extr emacsbug message puny rfc822 mml mml-sec epa derived epg rfc6068 epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils yank-media markdown-mode color noutline outline time-date files-x find-dired grep eglot external-completion array filenotify jsonrpc ert ewoc debug backtrace find-func flymake-proc flymake thingatpt compile text-property-search comint ansi-osc ansi-color imenu go-ts-mode treesit dired-aux denote xref project ring comp comp-cstr warnings cl-extra help-mode server rx dired dired-loaddefs icomplete cus-edit pp cus-load icons wid-edit easy-mmode clang-rename clang-include-fixer let-alist clang-format xml denote-autoloads elfeed-autoloads forge-autoloads closql-autoloads emacsql-autoloads geiser-chez-autoloads geiser-guile-autoloads geiser-autoloads ghub-autoloads htmlize-autoloads magit-autoloads pcase magit-section-autoloads dash-autoloads markdown-mode-autoloads racket-mode-autoloads tmr-autoloads transient-autoloads treepy-autoloads with-editor-autoloads info compat-autoloads yaml-autoloads zig-mode-autoloads reformatter-autoloads 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 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/pgtk-win pgtk-win term/common-win pgtk-dnd 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 dynamic-setting system-font-setting font-render-setting cairo gtk pgtk multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 198588 19413) (symbols 48 16484 6) (strings 32 50057 3480) (string-bytes 1 1645981) (vectors 16 31794) (vector-slots 8 605866 18429) (floats 8 196 642) (intervals 56 753 136) (buffers 984 20))
[Message part 3 (message/rfc822, inline)]
From: Yuan Fu <casouri <at> gmail.com> To: Roi Martin <jroi.martin <at> gmail.com> Cc: 75362-done <at> debbugs.gnu.org Subject: Re: bug#75362: 29.4; go-ts-mode.el: wrong indentation inside var list Date: Sun, 12 Jan 2025 22:35:35 -0800> On Jan 4, 2025, at 7:40 AM, Roi Martin <jroi.martin <at> gmail.com> wrote: > > When using the Go tree-sitter grammar v0.23.4 from > https://github.com/tree-sitter/tree-sitter-go.git, indentation inside > var lists does not work correctly. > > For instance, the following code is indented as: > > ``` > var ( > one = 1 > ) > ``` > > Instead of: > > ``` > var ( > one = 1 > ) > ``` > > Just in case it can help, I think this stopped working with grammar > version `v0.21.1`, that introduced `var_spec_list`: > > https://github.com/tree-sitter/tree-sitter-go/compare/v0.21.0...v0.21.1 > > Please, take it with a pinch of salt because I'm not very familiar with > tree-sitter. Thanks Roi, and especially thanks for finding the change in grammar! The good news is, I just checked and it’s fixed in Emacs 30. Before then, something like this should fix it for you: (add-hook 'go-ts-mode-hook #'fix-go-ts-mode-indentation) (defun fix-go-ts-mode-indentation () (setf (alist-get 'go treesit-simple-indent-rules) (append (alist-get 'go treesit-simple-indent-rules) '(((parent-is "var_spec_list") parent-bol go-ts-mode-indent-offset))))) Yuan
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.