Improvements to clang-format integrations.
This adds an emacs editor integration (thanks to Ami Fischman). Also
pulls out the style into a variable for the vi integration and just
uses clang-formats defaults style in clang-format-diff.py.
git-svn-id: svn://svn.chromium.org/llvm-project/cfe/trunk/tools/clang-format@179098 0b72dbe1-c17f-4bc7-b9db-2b4152be0356
diff --git a/clang-format.py b/clang-format.py
index de92257..d90c62a 100644
--- a/clang-format.py
+++ b/clang-format.py
@@ -23,6 +23,10 @@
# Change this to the full path if clang-format is not on the path.
binary = 'clang-format'
+# Change this to format according to other formatting styles (see
+# clang-format -help)
+style = 'LLVM'
+
# Get the current text.
buf = vim.current.buffer
text = "\n".join(buf)
@@ -34,7 +38,8 @@
str(vim.current.range.end + 2) + ')')) - offset - 2
# Call formatter.
-p = subprocess.Popen([binary, '-offset', str(offset), '-length', str(length)],
+p = subprocess.Popen([binary, '-offset', str(offset), '-length', str(length),
+ '-style', style],
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
stdout, stderr = p.communicate(input=text)