Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jkishner/7602309 to your computer and use it in GitHub Desktop.
Save jkishner/7602309 to your computer and use it in GitHub Desktop.
indent all
function actionHere () {
var string = op.getLineText();
if (string.charAt(0) == " ") {
op.reorg (right, 1);
var newline = string.substring(1);
op.setLineText(newline);
}
}
var ctheads = 0;
op.visitAll (function (headline) {
ctheads++;
});
ctheads = ctheads - 1;
op.firstSummit ();
for (var i = 0; i<ctheads; i++) {
actionHere ();
if (op.hasSubs ()) {
op.go (right, 1);
}
else if (!op.go (down, 1)) {
op.go (up, infinity);
op.go (left, 1);
while (!op.go (down, 1)) {
op.go (left, 1);
}
}
}
actionHere ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment