sonatard / clang-format

Clang-format emacs integration for use with C/Objective-C/C++.
36 stars 4 forks source link

feature request: clang-format-enable-format-on-save #3

Open Dushistov opened 6 years ago

Dushistov commented 6 years ago

It would be to have option with name like clang-format-enable-format-on-save, that use can enable and code in buffer will reformatted during saving on disk process.

matthuszagh commented 5 years ago

This doesn't directly address your request but I use this, which achieves that effect:

  :hook ((c-mode-common . (lambda ()
                            (add-hook 'before-save-hook 'clang-format-buffer nil t)))

Note that this used within the context of use-package, so you should change the syntax accordingly if not using use-package.