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: Fri, 8 Sep 2023 16:15:09 +0100

On Fri, Sep 8, 2023 at 2:32 PM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > Date: Fri, 08 Sep 2023 16:11:46 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> > Cc: theo@thornhill.no, casouri@gmail.com, spacibba@aol.com, 
> > emacs-devel@gnu.org
> >
> > > From: João Távora <joaotavora@gmail.com>
> > > Date: Fri, 8 Sep 2023 13:38:58 +0100
> > > Cc: theo@thornhill.no, casouri@gmail.com, spacibba@aol.com,
> > >     emacs-devel@gnu.org
> > >
> > > Anyway, it's worth pointing out that unless you're extremely adept
> > > at crafting indentation styles for Emacs, you're always in a losing
> > > battle when working on multiple projects, since many projects
> > > nowadays (not just C/C++) use an external format definition.
> > > A .clang-format  (even we have one since 2017) or other similar
> > > files.  These are understood by other editors and tools.
> >
> > I guess this means we should add a TODO item for supporting such
> > external specifications?
>
> Done; patches welcome.

I couldn't find your TODO item (in etc/TODO at least).  But I'm curious
as to how you will phrase it: "supporting" can have many meanings.

If it means "have some kind of interface for using" then Emacs already
has one, which is `eglot-format`.  Although indirect (because LSP), it
is a pretty effective in abstracting away different specs of different
such tools (clang-format, prettier, eslint, etc).

But if "supporting" means "plug into indent-line-function and
indent-region-function", then it's going to be relatively hard, because
as I explained, these are formatters, not indenters, so it's a bit
of a round-peg, square-hole problem.  So if you want to keep the
existing interface of those two functions (which would be ideal, since
a lot of tooling already depends on them), there would have to be some
way to communicate with these tools so that they only talk about
indentation.  Not saying it's impossible, but it's hard, at least
when LSP is used for abstracting away differences.

João



reply via email to

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