1

I want to fill (wrap) long lines at n characters, ensuring that each new line ends with "///". (That is the "continuation character" for long lines in Stata code.

So that something like this

This is a long line. This is a long line. This is a long line. This is a long line. This is a long line. This is a long line.

would be broken up into something like this

This is a long line. This is a long line. This is a long line. This ///
  is a long line. This is a long line. This is a long line.

(where the first line, along with the /// is no more than n characters.

I see info about prefixes in the fill section of the manual, but nothing about suffixes.

Thanks!

0

There's very little support for it in Emacs's standard infrastructure, sadly.
You can try using something like:

(add-function :around (local 'comment-line-break-function)
  #'my-insert-triple-slash-at-eol)
(defun my-insert-triple-slash-at-eol (orig-fun &rest args)
  (insert "///")
  (apply orig-fun args))
|improve this answer|||||
  • Really appreciate this, Stefan. Thanks! Can you give me a bit more guidance on how to implement your solution. I have evaled that code (without error!), but am not sure how to call the function when I have text that I want it to fill and add the /// at the end of the line. I am sorry for my ignorance, and thanks again! – Cheuk Jan 15 at 16:32
  • @Cheuk: I think it will only affect auto-fill-mode. – Stefan Jan 15 at 16:38

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.