@@ -183,6 +183,21 @@ point beyond the current column, position given by
183
183
(haskell-simple-indent-newline-same-col)
184
184
(insert (make-string haskell-indent-spaces ? )))
185
185
186
+ (defun haskell-simple-indent-comment-indent-function ()
187
+ " Haskell version of `comment-indent-function' ."
188
+ ; ; This is required when filladapt is turned off. Without it, when
189
+ ; ; filladapt is not used, comments which start in column zero
190
+ ; ; cascade one character to the right
191
+ (save-excursion
192
+ (beginning-of-line )
193
+ (let ((eol (line-end-position )))
194
+ (and comment-start-skip
195
+ (re-search-forward comment-start-skip eol t )
196
+ (setq eol (match-beginning 0 )))
197
+ (goto-char eol)
198
+ (skip-chars-backward " \t " )
199
+ (max comment-column (+ (current-column ) (if (bolp ) 0 1 ))))))
200
+
186
201
;;;### autoload
187
202
(define-minor-mode haskell-simple-indent-mode
188
203
" Simple Haskell indentation mode that uses simple heuristic.
@@ -197,6 +212,7 @@ Runs `haskell-simple-indent-hook' on activation."
197
212
:lighter " Ind"
198
213
:group 'haskell-simple-indent
199
214
:keymap '(([backtab] . haskell-simple-indent-backtab))
215
+ (set (make-local-variable 'comment-indent-function ) #'haskell-simple-indent-comment-indent-function )
200
216
(kill-local-variable 'indent-line-function )
201
217
(when haskell-simple-indent-mode
202
218
(set (make-local-variable 'indent-line-function ) 'haskell-simple-indent )
0 commit comments