1

I want to be able to execute a command in ESS to quickly add a horizontal line (using dashes) out to column 80.

This will be used for header comments. I'd like to be able to re-execute the command to redraw the line if I change the header comment as edits will change the end point of the line from column 80. E.g.

## Title here -------------------------

## Edited title here -------------------------

If I execute the command on the second one, it'll shorten it to the same length as the first (imagining that it ends at column 80).

  • check out comment-box (or is it box-comment?) for a way of doing something similar. If you don't like that, you could do exactly what you want with a few lines of elisp – Tyler Aug 17 '18 at 0:36
  • Thanks for pointing me in this direction. Yes, it's comment-box. But that led me onto rebox2, which is more customizable and super functional. – jdtonkin Aug 17 '18 at 4:59
1

Thanks to Tyler's comment above, I found rebox2. This enables easily adding comment boxes and changing them as you go, which is bound to M-q.

This doesn't do exactly as I asked, but it is very customizable and does the trick nicely for headings inside ESS. e.g.:

## ---------- ##    
## Title here ##
## ---------- ## 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.