@@ -175,6 +175,21 @@ column, `tab-to-tab-stop' is done instead."
175
175
(haskell-simple-indent-newline-same-col)
176
176
(insert (make-string haskell-indent-spaces ? )))
177
177
178
+ (defun haskell-simple-indent-comment-indent-function ()
179
+ " Haskell version of `comment-indent-function' ."
180
+ ; ; This is required when filladapt is turned off. Without it, when
181
+ ; ; filladapt is not used, comments which start in column zero
182
+ ; ; cascade one character to the right
183
+ (save-excursion
184
+ (beginning-of-line )
185
+ (let ((eol (line-end-position )))
186
+ (and comment-start-skip
187
+ (re-search-forward comment-start-skip eol t )
188
+ (setq eol (match-beginning 0 )))
189
+ (goto-char eol)
190
+ (skip-chars-backward " \t " )
191
+ (max comment-column (+ (current-column ) (if (bolp ) 0 1 ))))))
192
+
178
193
;;;### autoload
179
194
(define-minor-mode haskell-simple-indent-mode
180
195
" Simple Haskell indentation mode that uses simple heuristic.
@@ -189,6 +204,7 @@ Runs `haskell-simple-indent-hook' on activation."
189
204
:lighter " Ind"
190
205
:group 'haskell-simple-indent
191
206
:keymap '(([backtab] . haskell-simple-indent-backtab))
207
+ (set (make-local-variable 'comment-indent-function ) #'haskell-simple-indent-comment-indent-function )
192
208
(kill-local-variable 'indent-line-function )
193
209
(when haskell-simple-indent-mode
194
210
(set (make-local-variable 'indent-line-function ) 'haskell-simple-indent )
0 commit comments