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

Filling of Haddock comments is broken #851

Closed
khumba opened this issue Sep 5, 2015 · 12 comments
Closed

Filling of Haddock comments is broken #851

khumba opened this issue Sep 5, 2015 · 12 comments

Comments

@khumba
Copy link

khumba commented Sep 5, 2015

Set fill-column to 80 and try filling the following comment with M-q:

-- | asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf 1234 5678
-- 90ab
main :: IO ()

Despite the first line being longer than 80 characters, it won't move 5678 to the next line. If you remove the leading |, or remove the whole 90ab line, it will wrap, but if the comment already has multiple lines, it won't.

(haskell-version) reports haskell-mode 13.15-git (/home/khumba/.emacs.d/elpa/haskell-mode-20150904.1344/), and this is on NixOS 14.12. The only thing for haskell-mode in my ~/.emacs is:

(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)
@gracjan
Copy link
Contributor

gracjan commented Sep 6, 2015 via email

@khumba
Copy link
Author

khumba commented Sep 6, 2015

On Sat, 05 Sep 2015 23:46:07 -0700
Gracjan Polak [email protected] wrote:

Thanks for the report.

Can you add this as a test case in tests directory?

Sure. Not sure if you wanted a pull request (of course, the test
failed), but see #852.

gracjan added a commit that referenced this issue Sep 6, 2015
Add regression tests for Haddock comment fill bug #851.
@gracjan
Copy link
Contributor

gracjan commented Sep 6, 2015

@khumba: since there is a nice test case now how about you help us fixing this issue? We have something wrong with the definitions of paragraph-separate, paragraph-start or fill-prefix. More documentation here:

http://www.gnu.org/software/emacs/manual/html_node/emacs/Fill-Prefix.html
http://www.gnu.org/software/emacs/manual/html_node/emacs/Paragraphs.html

@khumba
Copy link
Author

khumba commented Sep 6, 2015

I'll take a look when I get a minute. One observation, -- ^ doesn't trigger the problem.

@khumba
Copy link
Author

khumba commented Sep 6, 2015 via email

@khumba
Copy link
Author

khumba commented Sep 6, 2015

Okay, I think the problem is that paragraph-separate should only match lines between paragraphs, and not the first line in each paragraph as well. When I remove the " *-- |" case from paragraph-separate, my
test case is fixed. Does this sound sensible?
I'll test this more thoroughly and send another PR. " *-- ^" also needs to be added to paragraph-start.

@khumba
Copy link
Author

khumba commented Sep 6, 2015

I have no idea why Github decided that there is quoted text in my previous comment, but it's not... On the subject of parsing bugs :).

@ivan-m
Copy link
Contributor

ivan-m commented Sep 7, 2015

I normally only see that quoted text in GitHub issues when someone replies via email rather than using the web interface.

@khumba
Copy link
Author

khumba commented Sep 7, 2015

"I normally only see that quoted text in GitHub issues when someone replies via email rather than using the web interface."

But then, there's usually text quoted with a greater than symbol or the like, but there wasn't in the email I sent. Guessing it had something to do with the " *-- ^"...

...and not the second paragraph...

@gracjan
Copy link
Contributor

gracjan commented Sep 7, 2015

Please have a look at font-lock. There are four symbols that can start haddock comment.

@gracjan
Copy link
Contributor

gracjan commented Sep 7, 2015

The precise definition of a paragraph boundary is controlled by the variables paragraph-separate and paragraph-start. The value of paragraph-start is a regular expression that should match lines that either start or separate paragraphs (see Regexps). The value of paragraph-separate is another regular expression that should match lines that separate paragraphs without being part of any paragraph (for example, blank lines). Lines that start a new paragraph and are contained in it must match only paragraph-start, not paragraph-separate. For example, in Fundamental mode, paragraph-start is "\f|[ \t]$", and paragraph-separate is "[ \t\f]$".

@gracjan
Copy link
Contributor

gracjan commented Dec 26, 2015

Fixed by #1037.

@gracjan gracjan closed this as completed Dec 26, 2015
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

No branches or pull requests

3 participants