Say I have a line in an emacs buffer that looks like this:
foo -option1 value1 -option2 value2 -option3 value3 \ -option4 value4 ...
I want it to look like this:
foo -option1 value1 \ -option2 value2 \ -option3 value3 \ -option4 value4 \ ...
I want each option/value pair on a separate line. I also want those subsequent lines indented appropriately according to mode rather than to add a fixed amount of whitespace. I would prefer that the code work on the current block, stopping at the first non-blank line or line that does not contain an option/value pair though I could settle for it working on a selected region.
Anybody know of an elisp function to do this?
Nobody had what I was looking for so I decided to dust off my elisp manual and do it myself. This seems to work well enough, though the output isn’t precisely what I asked for. In this version the first option goes on a line by itself instead of staying on the first line like in my original question.