Hi Alexander,<div><br></div><div>When I did external config for IWYU, I added an #include mechanism to allow configurations composed from different files. In our case it was  to support per-library configurations, which is probably not useful for clang-format. However, it might be nice for you to allow "use the Google style, but..." in the form of a base file and local overrides. E.g.</div>
<div><br></div><div>  # start from Google style</div><div>  BasedOn: <span></span>google.clang-format</div><div> </div><div>  # local adjustments</div><div>  ColumnLimit: 120</div><div>  ...<br><br>FWIW,</div><div>- Kim<br>
<br>On Monday, May 6, 2013, Alexander Kornienko  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">It's time for clang-format to support more flexible style configuration. We're starting to work on configuration files support for clang-format.<div>
<br><div>Some thoughts on desired features and overall design:<div>
<ul><li><b>contents</b>: fields of the FormatStyle struct, which currently has < 20 fields of primitive types;</li>
<li><b>format</b>: a set of key-value pairs, most probably JSON or YAML with flat structure, e.g.:<br>  ColumnLimit: 80<br>  ConstructorInitializerAllOnOneLineOrOnePerLine: true<br>  ...</li><li><b>file location</b>: in a longer term we'd like to support local per-project hierarchical model, so that style can be configured for a project and then partially or fully overridden in its various subprojects. E.g. for this directory structure:<br>

<font face="courier new, monospace">  dir:<br>    .clang-format<br>    a.cpp<br>    subdir:<br>      .clang-format<br>      b.cpp<br></font><br><font face="courier new, monospace"><b>clang-format dir/a.cpp</b></font> should read only <font face="courier new, monospace">dir/.clang-format</font> (assuming that there are no .clang-format files in parent directories), <font face="courier new, monospace"><b>clang-format dir/subdir/b.cpp</b></font> should use configuration values from <font face="courier new, monospace">dir/subdir/.clang-format</font>, and for the values not defined there try to get them from <font face="courier new, monospace">dir/.clang-format</font></li>

<li><font face="arial, helvetica, sans-serif"><b>command-line interface</b>: there's currently </font><font face="courier new, monospace">-style</font><font face="arial, helvetica, sans-serif"> option which takes a name of a predefined style, we can use "</font><font face="courier new, monospace">-style config</font><font face="arial, helvetica, sans-serif">" or "</font><font face="courier new, monospace">-style file</font><font face="arial, helvetica, sans-serif">" to turn on configuration file parsing, or turn it on by default.</font></li>

</ul><font face="arial, helvetica, sans-serif">Any comments/suggestions?</font></div></div></div></div>
</blockquote></div>