Is this correct? Right now, when I open a new buffer in vim with its pwd somewhere in my llvm or chromium checkout, clang-format will find the .clang-format file that's somewhere in a parent directory of the pwd and use the style from there. With this change, it looks like vim would always use style llvm instead of the style selected in a .clang-format file for unnamed buffers.
On Sat, Mar 8, 2014 at 10:07 PM, Ahmed Charles <[email protected]> wrote: > Hi djasper, > > This allows formatting of buffers before saving them without warnings. > > http://llvm-reviews.chandlerc.com/D3019 > > Files: > tools/clang-format/clang-format.py > > Index: tools/clang-format/clang-format.py > =================================================================== > --- tools/clang-format/clang-format.py > +++ tools/clang-format/clang-format.py > @@ -29,8 +29,8 @@ > # Change this to format according to other formatting styles. See the > output of > # 'clang-format --help' for a list of supported styles. The default looks > for > # a '.clang-format' or '_clang-format' file to indicate the style that > should be > -# used. > -style = 'file' > +# used if the vim buffer is associated with a file, or LLVM otherwise. > +style = None > > def main(): > # Get the current text. > @@ -52,9 +52,15 @@ > startupinfo.wShowWindow = subprocess.SW_HIDE > > # Call formatter. > - command = [binary, '-lines', lines, '-style', style, '-cursor', > str(cursor)] > + command = [binary, '-lines', lines, '-cursor', str(cursor)] > if vim.current.buffer.name: > command.extend(['-assume-filename', vim.current.buffer.name]) > + if style: > + command.extend(['-style', style]) > + elif vim.current.buffer.name: > + command.extend(['-style', 'file']) > + else: > + command.extend(['-style', 'LLVM']) > p = subprocess.Popen(command, > stdout=subprocess.PIPE, stderr=subprocess.PIPE, > stdin=subprocess.PIPE, startupinfo=startupinfo) > > _______________________________________________ > cfe-commits mailing list > [email protected] > http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits > >
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
