diff options
| author | Daniel Jasper <djasper@google.com> | 2013-04-17 07:55:02 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2013-04-17 07:55:02 +0000 |
| commit | dd77743af8623dc77fc9b90548b4343a7259f420 (patch) | |
| tree | d608464c6aa6f912642811bf34c6bc596d8ae207 /clang/docs | |
| parent | 08052afa2d3124dfa3050f5183522914b60eb9dd (diff) | |
| download | bcm5719-llvm-dd77743af8623dc77fc9b90548b4343a7259f420.tar.gz bcm5719-llvm-dd77743af8623dc77fc9b90548b4343a7259f420.zip | |
Small improvements to clang-format documentation and integration
scripts.
llvm-svn: 179676
Diffstat (limited to 'clang/docs')
| -rw-r--r-- | clang/docs/ClangFormat.rst | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/clang/docs/ClangFormat.rst b/clang/docs/ClangFormat.rst index 92d7fc319e1..1b65c2542bf 100644 --- a/clang/docs/ClangFormat.rst +++ b/clang/docs/ClangFormat.rst @@ -18,7 +18,6 @@ to format C/C++/Obj-C code. $ clang-format --help OVERVIEW: A tool to format C/C++/Obj-C code. - Currently supports LLVM and Google style guides. If no arguments are specified, it formats the code from standard input and writes the result to the standard output. If <file> is given, it reformats the file. If -i is specified together @@ -66,6 +65,22 @@ It operates on the current, potentially unsaved buffer and does not create or save any files. To revert a formatting, just undo. +Emacs Integration +================= + +Similar to the integration for :program:`vim`, there is an integration for +:program:`emacs`. It can be found at `clang/tools/clang-format/clang-format.el` +and used by adding this to your `.emacs`: + +.. code-block:: common-lisp + + (load "<path-to-clang>/tools/clang-format/clang-format.el") + (global-set-key [C-M-tab] 'clang-format-region) + +This binds the function `clang-format-region` to C-M-tab, which then formats the +current line or selected region. + + Script for patch reformatting ============================= @@ -81,7 +96,7 @@ a unified diff and reformats all contained lines with :program:`clang-format`. optional arguments: -h, --help show this help message and exit -p P strip the smallest prefix containing P slashes - -style STYLE formatting style to apply (LLVM, Google) + -style STYLE formatting style to apply (LLVM, Google, Chromium) So to reformat all the lines in the latest :program:`git` commit, just do: |

