Fix clang-format-sublime plugin for Sublime Text 3

Johan Engelen jbc.engelen at swissonline.ch
Fri Nov 8 12:57:12 PST 2013


Hi all,
   Sublime Text 3 uses Python 3.3 for its plugins (instead of 2.6 that 
Sublime Text 2 uses). The attached patch fixes clang-format-sublime.py 
to work in Sublime Text 3.
I am not a Python expert, but it seems for this plugin, the only 
relevant change is that "print" became a function, so parens are needed.
I tested the change and the patched plugin works in both Sublime Text 2 
and 3.

Thanks for the review, (and commit ;)
   Johan
-------------- next part --------------
Index: tools/clang-format/clang-format-sublime.py
===================================================================
--- tools/clang-format/clang-format-sublime.py	(revision 193933)
+++ tools/clang-format/clang-format-sublime.py	(working copy)
@@ -45,7 +45,7 @@
                          stderr=subprocess.PIPE, stdin=subprocess.PIPE)
     output, error = p.communicate(buf.encode(encoding))
     if error:
-      print error
+      print(error)
     self.view.replace(
         edit, sublime.Region(0, self.view.size()),
         output.decode(encoding))


More information about the cfe-commits mailing list