Skip to content

Commit 28f8323

Browse files
committed
Continue comment (e.g. haddock) when indenting
1 parent d74801c commit 28f8323

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

elisp/shm-indent.el

+14-4
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,21 @@ hai = do foo bar
147147
((or (= (line-beginning-position)
148148
(line-end-position))
149149
(not (shm-current-node)))
150-
(if (= (line-beginning-position)
151-
(line-end-position))
152-
(newline)
150+
(cond
151+
((= (line-beginning-position)
152+
(line-end-position))
153+
(newline))
154+
((save-excursion
155+
(move-beginning-of-line nil)
156+
(looking-at "--"))
153157
(progn (newline)
154-
(shm/simple-indent))))
158+
(shm/simple-indent)
159+
(save-excursion
160+
(move-beginning-of-line nil)
161+
(insert "--")
162+
(delete-char 2))))
163+
(t (progn (newline)
164+
(shm/simple-indent)))))
155165
((and (shm-in-string)
156166
(not (= (shm-node-start (shm-current-node))
157167
(point))))

0 commit comments

Comments
 (0)