Skip to content

Commit 497811f

Browse files
committed
haskell-cabal: fix (comment-dwim) by correcting comment-start-skip
Prior to this commit using (comment-dwim) over a comment in .cabal file that doesn't start at the beginning of a line resulted in it adding even more comments. E.g. this: -- comment not at the beginning of a line resulted in: -- -- comment not at the beginning of a line This is because `comment-start-skip` was including whitespace that isn't part of the comment syntax. Fix this by only limiting the regexp to the comment part. The resulting regexp is basically same as the one in haskell-mode, barring that that one also takes into account `{-` comment starter, which isn't a thing in .cabal files. Fixes: #1743
1 parent 2163e0d commit 497811f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

haskell-cabal.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ it from list if one of the following conditions are hold:
175175
(add-hook 'change-major-mode-hook 'haskell-cabal-unregister-buffer nil 'local)
176176
(add-hook 'kill-buffer-hook 'haskell-cabal-unregister-buffer nil 'local)
177177
(setq-local comment-start "-- ")
178-
(setq-local comment-start-skip "\\(^[ \t]*\\)--[ \t]*")
178+
(setq-local comment-start-skip "--[ \t]*")
179179
(setq-local comment-end "")
180180
(setq-local comment-end-skip "[ \t]*\\(\\s>\\|\n\\)")
181181
(setq-local indent-line-function 'haskell-cabal-indent-line)

0 commit comments

Comments
 (0)