Is there any package for automatically insert spaces in c++ code? reddit / emacs ---------------------------------------------------------------------- tms9918 · 2022-03-10 12:05 I love automatic indentation (M-x indent region), however I usually forget to leave spaces around the operators (let's say a=b+c). or after commas (let's say f(1,2) Is there some package that gives a command to format the above expressions to a = b + c and f(1, 2) ? ---------------------------------------------------------------------- r0vsdal · 2022-03-10 12:17 I use formatters in order to automatically format source code on save. Personally I use [apheleia](https://github.com/raxod502/apheleia) for this. It requires clang-tools installed as it uses clang formatter. ---------------------------------------------------------------------- tms9918 · 2022-03-10 13:50 This looks nice! ---------------------------------------------------------------------- fzmad · 2022-03-10 21:28 Take a look at [electric- operator](https://github.com/davidshepherd7/electric-operator) ---------------------------------------------------------------------- iscopak · 2022-03-11 00:24 Look for a package that uses clang-tidy ---------------------------------------------------------------------- [deleted] · 2022-03-11 10:06 I usually use `clangd` as my LSP and calling either lsp-buffer-format or eglot-format on before-save-hook will do edits to make code pretty. You can also use clang-format package available on MELPA but clangd itself relies on clang-format to format you code.