<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=utf-8">
</head>
<body>
<div style="font-family:sans-serif"><div style="white-space:normal">
<p dir="auto">On 19 Sep 2018, at 21:34, kruemelkeksfan wrote:</p>
</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">a)<br>
<br>
Allan Odgaard wrote</p>
<blockquote style="border-left:2px solid #777; color:#999; margin:0 0 5px; padding-left:5px; border-left-color:#999"><p dir="auto">This style can’t be expressed with the current classification patterns.</p>
</blockquote><p dir="auto">this has changed by now?</p>
</blockquote></div>
<div style="white-space:normal">
<p dir="auto">No, I don’t recall there having been made any changes to support <a href="https://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style" style="color:#3983C4">https://en.wikipedia.org/wiki/Indentation_style#Whitesmiths_style</a></p>
</div>
<div style="white-space:normal"><blockquote style="border-left:2px solid #777; color:#777; margin:0 0 5px; padding-left:5px"><p dir="auto">b) Whitesmith-style can't be (roughly) expressed by just increasing indent<br>
after a line finishes with ')' instead of '{', '}' or ';' and decreasing it<br>
after a line with a lone '}'? It doesn't need to be 100% accurate, a crude<br>
approximation for not having to type every single indent would be good<br>
enough for me...</p>
</blockquote></div>
<div style="white-space:normal">
<p dir="auto">You can make it increase indent after <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">)</code> (or maybe just lines not ending with <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">;</code> or braces), but the decrease indent pattern includes current line, so that would fail.</p>
<p dir="auto">There would also be an issue with single line <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">if</code>, <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">for</code>, and <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">while</code> statements.</p>
<p dir="auto">With the above, you end up with patterns like this:</p>
<pre style="background-color:#F7F7F7; border-radius:5px 5px 5px 5px; margin-left:15px; margin-right:15px; max-width:90vw; overflow-x:auto; padding:5px" bgcolor="#F7F7F7"><code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0" bgcolor="#F7F7F7">{ increaseIndentPattern = '(?x)
(?! .* [;:{},] \s* # do not indent when line ends with ;, :, {, }, or comma
( // .* | /[*] .* [*]/ \s* )? $ # …account for potential trailing comment
| @(public|private|protected) # do not indent after obj-c data access keywords
)
. # the negative look-ahead above means we don’t care about what we match here
';
decreaseIndentPattern = '(?x)
(?=not)possible
';
indentNextLinePattern = '(?x)^
(?=not)possible
';
unIndentedLinePattern = '^\s*((/\*|\*/|//|template\b.*?>(?!\(.*\))|@protocol|@optional|@interface(?!.*\{)|@implementation|@end).*)?$';
zeroIndentPattern = '^\s*#';
}
</code></pre>
<p dir="auto">I just disabled <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">decreaseIndentPattern</code> and <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">indentNextLinePattern</code>, plus made <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">increaseIndentPattern</code> use the pattern from the previous <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">indentNextLinePattern</code> pattern.</p>
<p dir="auto">Additionally you would have to edit the <em>Return Inside Empty Item</em> snippet in the source bundle. This triggers when you press return with insertion point between two braces, i.e. <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">{‸}</code> — adding <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">- source.c</code> to the scope selector should disable that for C.</p>
<p dir="auto">Still, you may see TextMate’s indent corrector sometimes changing the indent of the current line, because the patterns does not correctly express how source should be indented.</p>
<p dir="auto">The latter can be disabled by setting <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">disableIndentCorrections = :true;</code> for <code style="background-color:#F7F7F7; border-radius:3px; margin:0; padding:0 0.4em" bgcolor="#F7F7F7">source.c</code>.</p>
</div>
</div>
</body>
</html>