summaryrefslogtreecommitdiff
path: root/Documentation/EmacsConfiguration.md
diff options
context:
space:
mode:
authorRiyyi <riyyi3@gmail.com>2022-08-06 12:35:29 +0200
committerBrian Gianforcaro <b.gianfo@gmail.com>2022-08-08 16:36:23 -0400
commit77f0a66d2fb65ce4a447b2f2481c489c2a8e231f (patch)
treeccd2e224764bd1143db8cbfd9e97a93ac7a1df61 /Documentation/EmacsConfiguration.md
parent6744402dbfe08af7324c8ff8134deb10ee967343 (diff)
downloadserenity-77f0a66d2fb65ce4a447b2f2481c489c2a8e231f.zip
Documentation: Add clang-format variant to EmacsConfiguration.md
Add a variant of auto formatting using clang-format that doesn't use additional packages. It works by adding a buffer-local hook to `'before-save` for all C++ project files.
Diffstat (limited to 'Documentation/EmacsConfiguration.md')
-rw-r--r--Documentation/EmacsConfiguration.md6
1 files changed, 6 insertions, 0 deletions
diff --git a/Documentation/EmacsConfiguration.md b/Documentation/EmacsConfiguration.md
index bcf9d2afc8..1abcc882f8 100644
--- a/Documentation/EmacsConfiguration.md
+++ b/Documentation/EmacsConfiguration.md
@@ -54,4 +54,10 @@ There are multiple packages to handle auto formatting with
- [format-all-mode](https://github.com/lassik/emacs-format-all-the-code)
- [clang-format-plus](https://github.com/SavchenkoValeriy/emacs-clang-format-plus)
+Alternatively, this can be done without additional packages, using `lsp-mode`.
+You can use the following `.dir-locals.el` file placed in the project root:
+
+```lisp
+((c++-mode
+ (eval add-hook 'before-save-hook #'lsp-format-buffer nil t)))
```