emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: c-ts-mode


From: João Távora
Subject: Re: c-ts-mode
Date: Tue, 12 Sep 2023 08:45:56 +0100

On Tue, Sep 12, 2023 at 1:34 AM Yuan Fu <casouri@gmail.com> wrote:

> > I'll let Theo and Yuan chime in on the other points you make.
>
> I don’t think users would be happy if they need to know CLOS to customize 
> indentation rules.

I'll leave that to you, but FWIW I've frequently had unsolicited
positive feedback on CLOS-based customization techniques, including two
recent ones:

  bug#65418
  https://github.com/joaotavora/breadcrumb/issues/6#issuecomment-1710745508

This seems to indicate that, all other things being equal, if users
are asked to go to Elisp, they don't mind (and actually enjoy) using
CLOS (or at least defgeneric) APIs.

> IMO users would be better off modifying treesit-simple-indent-rules in the 
> major mode hook. It’s an alist of (LANGUAGE . RULES).
>
> So something like
>
> (setf (alist-get 'lang treesit-simple-indent-rules)
>       (append '(custom-rules...)
>               (alist-get 'lang treesit-simple-indent-rules)))
>
> Would do the trick.

Would it? That's not idempotent, is it?

What is LANGUAGE exactly?  A major mode symbol, or one of those
closely related treesit symbols for the shared object library?

And where does the C/C++ base style ('gnu, 'k&r, 'stroutroup, etc)
enter here?  The typical use case is to pick one of these styles
for C/C++ and tweak it (in an idempotent fashion, of course).

João



reply via email to

[Prev in Thread] Current Thread [Next in Thread]