git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH 3/4] .clang-format: do not enforce a ColumnLimit

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 11, 2022, 23:30 UTC
Message-ID
<xmqqtu7njkgt.fsf@gitster.g>
In-Reply-To
<CAPig+cSkGsS4VouBoaTB_zBEL48-=JBf4PKLJMpj8r342n=YUw@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 7 quoted lines
> So, even if you manually wrap the code to fit nicely in 80
> columns, if clang-format is set to 132 columns, then it will
> automatically reflow your nicely hand-wrapped 80-column code out
> to 132 columns, which I think is not what we'd want (at least
> those of us who always work in 80-column terminals and
> editors). But perhaps there is a configuration knob which disables
> clang-format's "reflow-to-occupy-full-width" behavior? brian?
Agreed.
We should keep in mind that there is no single good fill-column.

When we say "wrap your lines at around 80 columns", we mean that when there is a good place to fold at around column 65 and the next good place is at column 82, then it is OK to go slightly over 80 and wrap at 82, which may be better than wrapping at 65. If the last good place to wrap is at column 72 and the long function call at the end of the line makes you go past the 82nd column, wrapping at column 72 might be better.

I wonder if there is an automated formatter that understands this kind of shades of gray and lets us express that.

Thanks.
Previous: Eric SunshineNext: Ævar Arnfjörð Bjarmason
Message 22 of 27 in “Automatic code formatting”
  1. brian m. carlsonJul 10, 2022
  2. Junio C HamanoJul 10, 2022
  3. rsbecker@nexbridge.comJul 10, 2022
  4. brian m. carlsonJul 11, 2022
  5. rsbecker@nexbridge.comJul 11, 2022
  6. Elijah NewrenJul 11, 2022
  7. Ævar Arnfjörð BjarmasonJul 11, 2022
  8. Elijah NewrenJul 11, 2022
  9. 0/4 make headway towards a clean "clang-format"Ævar Arnfjörð Bjarmason, Jul 11, 2022
  10. 2/4 .clang-format: Add a BitFieldColonSpacing=None ruleÆvar Arnfjörð Bjarmason, Jul 11, 2022
  11. brian m. carlsonJul 11, 2022
  12. Junio C HamanoJul 11, 2022
  13. Ævar Arnfjörð BjarmasonJul 12, 2022
  14. Tuomas AholaSep 11, 2026
  15. 1/4 Makefile: add a style-all targets for .clang-format testingÆvar Arnfjörð Bjarmason, Jul 11, 2022
  16. 3/4 .clang-format: do not enforce a ColumnLimitÆvar Arnfjörð Bjarmason, Jul 11, 2022
  17. Junio C HamanoJul 11, 2022
  18. Ævar Arnfjörð BjarmasonJul 12, 2022
  19. brian m. carlsonJul 11, 2022
  20. Junio C HamanoJul 11, 2022
  21. Eric SunshineJul 11, 2022
  22. Junio C HamanoJul 11, 2022
  23. 4/4 .clang-format: don't indent "goto" labelsÆvar Arnfjörð Bjarmason, Jul 11, 2022
  24. Junio C HamanoJul 11, 2022
  25. Ævar Arnfjörð BjarmasonJul 12, 2022
  26. Phillip WoodJul 11, 2022
  27. Ævar Arnfjörð BjarmasonJul 11, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.