npchitman · 2022-05-22 01:51
It's bothered me for a long time.
Is there any way to let indentation behavior work consistent with some format extension like clang-format or editorconfig?
when I code in c++ with emacs and hit `ret` or some [indentation commands](https://www.gnu.org/software/emacs/manual/html_node/emacs/Indentation-Commands.html) in the class body, it just indents follow it's 'internal' way and my config file, and that's not always the same behavior with my project `.clang-format` or `editorconfig` setup.
kastauyra · 2022-05-22 07:52
I was bothered by this too and I don’t think a good way exists. clang-format formats and cc-mode only indents, there is an impedance mismatch right here. I have been trying to manually write indentation definitions to match my .clang-format styles, but the result was never satisfactory save for the basics of how many spaces per tab stop. This made my workflow to essentially ignore the indentation altogether in favor of reformatting the buffer with a keyboard shortcut every few lines.
paretoOptimalDev · 2022-05-31 06:29
You can use apheleia-mode and frequently run the formatter like a linter if it's fast enough.