4

Haskell has line comments starting with -- and multiline comments of the form {- ... -}. I'd like to make auto-fill-mode work for both of those.

Currently line comments are auto-filled correctly:

-- abc abc abc abc abc abc abc abc abc abc abc abc abc 
-- abc abc abc abc abc abc abc abc abc 

but multiline comments are not:

{- abc abc abc abc abc abc abc abc abc abc abc abc abc 
{- abc abc abc abc abc abc abc abc abc 

it should be just with spaces:

{- abc abc abc abc abc abc abc abc abc abc abc abc abc 
   abc abc abc abc abc abc abc abc abc 

current settings are:

(set (make-local-variable 'comment-start) "-- ")
(set (make-local-variable 'comment-padding) 0)
(set (make-local-variable 'comment-start-skip) "[-{]-[ \t]*")
(set (make-local-variable 'comment-end) "")
(set (make-local-variable 'comment-end-skip) "[ \t]*\\(-}\\|\\s>\\)")

How to set this up so that comment auto-fill works for both kinds of comments?

More about Haskell Mode: https://github.com/haskell/haskell-mode

  • 1
    You should look at the adaptive-fill-function. – Stefan Oct 19 '15 at 1:01
  • Thanks. I'm still not clear how this should work but at least I have a clue where to look next. – Gracjan Polak Oct 20 '15 at 13:56

Your Answer

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

Browse other questions tagged or ask your own question.