haskell / haskell/haskell-mode
Better support for block comments
- Dominant language
- Emacs Lisp
- Stars
- 1.4k
- Forks
- 354
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 2
Description
Currently, if you have a paragraph in a block comment which is indented, doing `M-q` (i.e. `fill-paragraph`, which ends up calling `haskell-fill-paragraph`) will un-indent all but the first line (and the comments in `haskell-fill-paragraph` admit that "{- -} comments need some extra love."
I've been playing with this over the past few days without success: ultimately, what fails is that `indent-line-function` is dependent upon which indentation mode is chosen:
- `indent-region` works with `haskell-simple-indent`
- `indent-region` is explicitly disabled in `haskell-indent` and `haskell-indentation` (presumably because of tab-cycles, etc.).
The only solution I can think of is to temporarily override `fill-prefix`; I've currently got some elisp that will find the first character in a paragraph (skipping over the `{-` comment starter, haddock markup (`|`, `^`, and also list markers) but I'm not sure if this is a safe or sane thing to do... The problem with this would be, if we fill and _then_ indent, the lines could extend past `fill-column` :/
Contributor guide
Research direction
Reproduce the issue by running M-q/fill-paragraph on an indented paragraph inside a block comment, then read haskell-fill-paragraph and the indentation modes mentioned: haskell-simple-indent, haskell-indent, and haskell-indentation. Done means filling preserves the comment's indentation without causing lines to extend past fill-column.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs-lisp, haskell
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100