GNU bug report logs - #60443
29.0.60; c-ts-mode: Consider re-using c-file-style and c-basic-offset

Previous Next

Package: emacs;

Reported by: Mohammed Sadiq <sadiq <at> sadiqpk.org>

Date: Sat, 31 Dec 2022 03:18:02 UTC

Severity: normal

Found in version 29.0.60

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: Mohammed Sadiq <sadiq <at> sadiqpk.org>
Cc: 60443 <at> debbugs.gnu.org
Subject: bug#60443: 29.0.60; c-ts-mode: Consider re-using c-file-style and c-basic-offset
Date: Fri, 30 Dec 2022 20:02:55 -0800

> On Dec 30, 2022, at 7:17 PM, Mohammed Sadiq <sadiq <at> sadiqpk.org> wrote:
> 
> It would be nice if c-ts-mode respects c-file-style and c-basic-offset
> instead of its own variables.  Also I wish c-ts-mode respects other c-mode
> variables (ie, cc-styles.el) so that I could use the same c-mode conf for
> c-ts-mode too, eg., I could use:
> 
> /* -*- c-file-style: "gnu"; c-basic-offset: 4; -*- */
> 
> as file variables which would work both in c-mode and c-ts-mode, or the
> following in dir-locals:
> 
> ((nil . ((fill-column . 80)))
>  (c-ts-mode . ((c-file-style . "GNU")
>                (c-file-offsets
>                (brace-list-intro . +)))))
> 
> Whether the mode used for C source file is c-ts-mode or c-mode is an
> implementation detail as far as the settings are concerned (because I
> don't want different styles for my code depending on the mode used).
> 
> I'm not asking about implementing the spacing and indentation rules, but
> when they do, it would be nice if they re-use the same c-mode variable
> names.

IIUC part of the reason why we created separate major modes is that we don’t want to share configuration variables between the tree-sitter and elisp implementation. If they share some of the configuration variable but not all, it would be very confusing; it they share all variables, well that’s not possible because c-ts-mode doesn’t support all of c-mode’s features. Also, since c-ts-mode and c-mode’s implementation differs greatly, some of c-mode’s configuration wouldn’t make sense, or is hard to recreate, in c-ts-mode.

I’m sorry that there will inevitably be differences between c-ts-mode and c-mode. We’ll try to minimize the annoyance but it won’t be perfect.

Yuan



This bug report was last modified 2 years and 157 days ago.

Previous Next


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