3

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!

Cheuk
  • 31
  • 1

1 Answers1

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))
Stefan
  • 26,404
  • 3
  • 48
  • 85
  • 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 '20 at 16:32
  • @Cheuk: I think it will only affect auto-fill-mode. – Stefan Jan 15 '20 at 16:38