haskell / haskell/haskell-mode
Make indent-according-to-mode continue previous line indentation on empty lines
- Dominant language
- Emacs Lisp
- Stars
- 1.4k
- Forks
- 354
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 2
Description
`indent-according-to-mode` is called in:
1. In `newline-and-indent`.
2. In `electric-indent-mode` after `\n` has been inserted.
3. In `evil-open-above`.
4. In `evil-open-below`.
Each of these cases is same: it is to semantically continue previous line. So we need:
1. If previous line ends with operator, continue expression.
2. If inside parenthesized expression, continue on the level of the expression.
3. Lacking other context continue same indentation block.
Note that `haskell-indentation` already has `haskell-indentation-newline-and-indent` that touches this problem but hard to say how good it is.
Reference: https://github.com/syl20bnr/spacemacs/issues/5010, https://github.com/syl20bnr/spacemacs/issues/621, https://github.com/syl20bnr/spacemacs/issues/3162, https://github.com/haskell/haskell-mode/issues/896
Contributor guide
Research direction
Start by tracing the four callers of indent-according-to-mode: newline-and-indent, electric-indent-mode, evil-open-above, and evil-open-below. Compare their behavior with haskell-indentation-newline-and-indent, then verify that empty-line indentation follows the operator, parenthesized-expression, and surrounding-block cases described in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- emacs-lisp, haskell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100