Re: clang-format

Alejandro Colomar via Mutt-dev <[email protected]>
Newsgroups gmane.mail.mutt.devel
Message-ID <absCpD42YlnY6WKj@devuan>
On 2026-03-18T18:14:02+0100, Alejandro Colomar wrote:
> Hi Will,
> 
> On 2026-03-18T09:54:38-0700, Will Yardley wrote:
> > On Wed, Mar 18, 2026 at 11:21:28AM +0800, Kevin J. McCarthy wrote:
> > > On Wed, Mar 18, 2026 at 01:11:14AM +0100, Alejandro Colomar via Mutt-dev wrote:
> > > > Okay, so I've tried today clang-format(1) for the first time, after
> > > > someone suggested it in a project I co-maintain, and now have a well
> > > > formed opinion about it:
> > 
> > > > It's pure crap.  Please don't use it.
> > [...]
> > > Before I drop the proposal, though, are there any Mutt devs/contributors who
> > > would like to play devil's advocate?
> > 
> > In more or less the same boat as Robin on this.
> > 
> > I am not a C programmer, and can't speak to clang-format specifically. I
> > will say broadly that, since starting to use them, I have really
> > appreciated autoformatters generally (ruff / black for Python, prettier
> > for js, etc.), especially when working with a team of people. It may
> > well turn out that there isn't a good tool available for C, but I do
> > think that if it is possible to find a formatter that works and can be
> > enforced, there is a lot to be said for both the resulting consistency,
> > and kind of taking arguments / bikeshedding about code style and
> > formatting out of the equation.
> > 
> > I'm not sure if the concerns Alejandro mentioned are about the
> > functionality of the program, its default configuration, or both. It
> > does seem like the program supports formatting based on different style
> > guides, and configuring certain parameters
> > (https://clang.llvm.org/docs/ClangFormatStyleOptions.html), so maybe
> > some objections could be overcome by either disabling certain types of
> > formatting, or choosing different config settings?
> 
> The problem is the fundamental functionality of the program.  It doesn't
> have any way to fix the problems with configuration.

BTW, clang-format(1) programmers are aware of this limitation (people
have reported it in the past), and they claim it will never be
implemented, because the design of clang-format makes it almost
impossible.

See also:
<https://stackoverflow.com/questions/30763869/how-can-i-apply-only-one-clang-format-action>
<https://github.com/llvm/llvm-project/issues/53924>


Cheers,
Alex

> 
> > Or, maybe come up with the style guide first, then work backwards from
> > that to see if a formatter / formatter config can be created that will
> > work?
> 
> I don't know if there are any other formatters that would be good.
> And I don't think writing a formatter from scratch just for mutt(1)
> would be reasonable.  But what is clear is that clang-format(1) is
> really bad.  If anyone wants to work on a new formatter, or knows of
> another formatter that is better, I'm fine with that.
> 
> 
> Have a lovely day!
> Alex
> 
> -- 
> <https://www.alejandro-colomar.es>



-- 
<https://www.alejandro-colomar.es>
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEES7Jt9u9GbmlWADAi64mZXMKQwqkFAmm7A0AACgkQ64mZXMKQ
wqnv9g//RqK3kLjfFKIofVIM6/6yrLlvYNAMawa0ykijdfimRA2qfxw361df4CoG
7gvfq/5E+T9ExdPS7ie7qjS/SYK9WVjnvumA8f3EIJ7NgzJdlfvOtnB+7pRpltSD
tj23AHiGPaMkqWrcrCVtxKThuB9mQGTMnEvg7P6+PiZMcEq+a9Qt8AsYPbsGSqrU
YkvEC03rgdnH0Xzamgwf8NLw2K21GXbi5/oHqS6unlYU0SbEcCwWGWrOJdw3Prl0
NJZ7EBuKNk4u8ce0zY4F4mJyI2AyGG2MiX9i0UJhV3NxGbxBO70oGm/IkPOCuP7A
7BBzrfkEfiUzoBieyon+l4IZSyabx2LIJRzYU6gvsLbMZzPHCFxcxNwoR8sXbVX2
1PeE3Ry9CfAVyV6ozO4sMJRqko7Z8i8lj7He19BZoC5Q2eLNTdJRj+C5X/NqbDdW
kXzceFLK2S8GCNBt0OBDWtV+PBi9zx9HaF9aBkLyv5Jp/wQhxezhpPRTKhiAxxZj
URYn0WZFuFNCRQ9w46+BIE1Sp2NuvqZ2GClOmtuerhnKTSddAAD1Oz66er0SKMqe
5rbC7LRJ/Sk0LdCcbfJE6HB+ZymNli7qGEUdGeNg9ITbeajjkBDWSsefPy2kzNLX
cmod+YPEavLSxi+IP7Dj4i/wdUpC/zkXnx47cpS8KY8reVG1EM4=
=eRoQ
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.