Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

haskell-cabal: fix (comment-dwim) by correcting comment-start-skip #1870

Merged
merged 1 commit into from
Mar 5, 2025

Conversation

Hi-Angel
Copy link
Contributor

@Hi-Angel Hi-Angel commented Mar 4, 2025

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

@Hi-Angel Hi-Angel changed the title Fix (comment-dwim) by correcting comment-start-skip cabal-mode: fix (comment-dwim) by correcting comment-start-skip Mar 4, 2025
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: haskell#1743
@Hi-Angel Hi-Angel force-pushed the fix-cabal-uncomment branch from eb65529 to 497811f Compare March 4, 2025 22:20
@Hi-Angel Hi-Angel changed the title cabal-mode: fix (comment-dwim) by correcting comment-start-skip haskell-cabal: fix (comment-dwim) by correcting comment-start-skip Mar 4, 2025
@Hi-Angel
Copy link
Contributor Author

Hi-Angel commented Mar 4, 2025

Just realized there was a bugreport for this, added to "fixes".

@purcell purcell merged commit 9780794 into haskell:master Mar 5, 2025
11 checks passed
@purcell
Copy link
Member

purcell commented Mar 5, 2025

Nice, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

toggling a comment does not work in Haskell-Cabal mode
2 participants