GNU bug report logs -
#75442
31.0.50; c-ts-mode indentation problem
Previous Next
Reported by: Uygar KÖSEER <uygarkoseer <at> gmail.com>
Date: Wed, 8 Jan 2025 17:56:01 UTC
Severity: normal
Found in version 31.0.50
Done: Yuan Fu <casouri <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your bug report
#75442: 31.0.50; c-ts-mode indentation problem
which was filed against the emacs package, has been closed.
The explanation is attached below, along with your original report.
If you require more details, please reply to 75442 <at> debbugs.gnu.org.
--
75442: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=75442
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
> On Jan 10, 2025, at 5:20 PM, Stefan Kangas <stefankangas <at> gmail.com> wrote:
>
> Uygar KÖSEER <uygarkoseer <at> gmail.com> writes:
>
>> Hi,
>>
>> I started to use c-ts-mode (tree-sitter) and I think there is a little
>> indentation problem when typedef declaration is used.
>>
>> Wrong indentation case:
>>
>> typedef struct Point
>> {
>> int x;
>> int y;
>> } Point;
>>
>> I think this happens because it aligns it with the struct keyword.
>>
>> Working case:
>> typedef struct Point Point;
>> struct Point
>> {
>> int x;
>> int y;
>> } Point;
>>
>> This case works without problem because the struct keyword is at the
>> beginning of the line.
>>
>> Both of the cases are matched with this part in c-ts-mode.el:
>> ((parent-is ,(rx (or "function_definition"
>> "struct_specifier"
>> "enum_specifier"
>> "function_declarator"
>> "template_declaration")))
>> parent 0)
>>
>> I also tried to change this behaviour by adding new rules to my
>> c-ts-mode configuration but it always matches with the default
>> configuration first. I do not know if there is any way to change this
>> behaviour without re-defining all the default configuration.
>
> Theodor, any comments here?
This is caused by some recent changes I made. I pushed a fix to master.
Yuan
[Message part 3 (message/rfc822, inline)]
[Message part 4 (text/plain, inline)]
Hi,
I started to use c-ts-mode (tree-sitter) and I think there is a little
indentation problem when typedef declaration is used.
Wrong indentation case:
typedef struct Point
{
int x;
int y;
} Point;
I think this happens because it aligns it with the struct keyword.
Working case:
typedef struct Point Point;
struct Point
{
int x;
int y;
} Point;
This case works without problem because the struct keyword is at the
beginning of the line.
Both of the cases are matched with this part in c-ts-mode.el:
((parent-is ,(rx (or "function_definition"
"struct_specifier"
"enum_specifier"
"function_declarator"
"template_declaration")))
parent 0)
I also tried to change this behaviour by adding new rules to my
c-ts-mode configuration but it always matches with the default
configuration first. I do not know if there is any way to change this
behaviour without re-defining all the default configuration.
In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2025-01-08 built on DESKTOP-NF56V2Q
System Description: Ubuntu 22.04.3 LTS
Configured using:
'configure --with-native-compilation --with-pgtk --with-x-toolkit=lucid
--with-tree-sitter --with-mailutils'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER XIM GTK3 ZLIB
Important settings:
value of $LANG: C.UTF-8
locale-coding-system: utf-8-unix
Major mode: C/*
Minor modes in effect:
highlight-numbers-mode: t
rainbow-delimiters-mode: t
fancy-dabbrev-mode: t
marginalia-mode: t
savehist-mode: t
projectile-mode: t
vertico-mode: t
gcmh-mode: t
recentf-mode: t
repeat-mode: t
global-auto-revert-mode: t
global-so-long-mode: t
global-hl-line-mode: t
electric-pair-mode: t
override-global-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
window-divider-mode: t
minibuffer-regexp-mode: t
column-number-mode: t
line-number-mode: t
global-visual-line-mode: t
visual-line-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/nukoseer/.emacs.d/elpa/modus-themes-20241228.1050/theme-loaddefs
hides /usr/local/share/emacs/31.0.50/lisp/theme-loaddefs
Features:
(shadow sort mail-extr emacsbug message yank-media puny dired
dired-loaddefs 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 mule-util bug-reference cursor-sensor comp-run
comp-common highlight-numbers parent-mode rainbow-delimiters
fancy-dabbrev popup dabbrev c++-ts-mode c-ts-mode c-ts-common treesit
which-key marginalia orderless savehist projectile project lisp-mnt
thingatpt rg vc vc-dispatcher rg-info-hack rg-menu transient pcase
rg-ibuffer rg-result wgrep-rg wgrep rg-history rg-header ibuf-ext
ibuffer ibuffer-loaddefs vertico compat tramp trampver tramp-integration
files-x tramp-message tramp-compat shell pcomplete parse-time iso8601
time-date format-spec tramp-loaddefs smartscan gcmh modus-vivendi-theme
modus-themes cus-edit pp grep compile text-property-search comint
ansi-osc ansi-color ring cus-load recentf tree-widget wid-edit repeat
autorevert filenotify display-line-numbers so-long hl-line elec-pair
narrow-indirect make-mark-visible edmacro kmacro advice rx cl-extra
help-mode finder-inf use-package use-package-ensure use-package-delight
use-package-diminish use-package-bind-key bind-key easy-mmode
use-package-core avy-autoloads buffer-move-autoloads
consult-dir-autoloads dumb-jump-autoloads dash-autoloads
embark-consult-autoloads consult-autoloads embark-autoloads
fancy-dabbrev-autoloads gcmh-autoloads highlight-numbers-autoloads
marginalia-autoloads modus-themes-autoloads multiple-cursors-autoloads
orderless-autoloads parent-mode-autoloads popup-autoloads
projectile-autoloads rainbow-delimiters-autoloads info rg-autoloads
s-autoloads smartscan-autoloads vertico-autoloads wgrep-autoloads
package browse-url xdg 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/pgtk-win pgtk-win term/common-win touch-screen 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
lcms2 multi-tty move-toolbar make-network-process tty-child-frames
native-compile emacs)
Memory information:
((conses 16 485596 224491) (symbols 48 26240 173)
(strings 32 135066 15749) (string-bytes 1 3787317) (vectors 16 36037)
(vector-slots 8 439371 76445) (floats 8 134 924)
(intervals 56 827 240) (buffers 992 13))
[Message part 5 (text/html, inline)]
This bug report was last modified 128 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.