I am transforming some scripts to use other functions or variables. The function calls are rather long and are therefore split into multiple lines.
To have an easier time transforming them and to not hinder regexp with newlines I do remove those, then swap around variables and exchange other expressions.
I end up with a working long line of code, which I want to again split into multiple lines with (...) after the frist commata that exceeds some "default" code length (~45chars?).
a) Is there already any such function (similar to SmartIndent) ?
b) If I had to program it myself, I would start by finding the whole command (until first semicolon ';'). Then I would cut off the first 45 chars and chain it with the regexp-match until the first commata ',' (which I also cut off the original command). I add the '...' and newline chars. Repeat this as long (while) the original command char array's size is still > 45). Then I can replace the original command with the new command in my text-/.m-file.
Any ideas to improve this? Is there a way to call smartindent as a function to run over the code?
I do realize that reformatting the code manually would improve readability a lot more, but at this point it is more about automatisation.