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 block comments produces "unexpected end of comment block" error #7

Closed
holtzermann17 opened this issue Jul 24, 2018 · 3 comments

Comments

@holtzermann17
Copy link

I open a new mode Lean buffer and put in contents as follows:

/- xxx xxxx xx.xxxxx xx xxxx xx xxxxxx xxx xxxxxxxxx xxxxxxxxx xxxxx, xxxxx xxxxx xxx xxxx xxxxxxxx xxxxxxxxxxxxx. -/

Then push M-q with the cursor anywhere on that line. I get:

/- xxx xxxx xx.xxxxx xx xxxx xx xxxxxx xxx xxxxxxxxx xxxxxxxxx xxxxx,
/- xxxxx xxxxx xxx xxxx xxxxxxxx xxxxxxxxxxxxx. -/

Flycheck now notices an error, unexpected end of comment block (lean-checker) (details via M-x flycheck-list-errors on the second line).


This behaviour could be improved, though I'm not immediately sure what the programming solution is, the expected output would be

/- xxx xxxx xx.xxxxx xx xxxx xx xxxxxx xxx xxxxxxxxx xxxxxxxxx xxxxx,
   xxxxx xxxxx xxx xxxx xxxxxxxx xxxxxxxxxxxxx. -/
@holtzermann17
Copy link
Author

holtzermann17 commented Aug 6, 2018

It looks like this is the relevant documentation page:
https://www.gnu.org/software/emacs/manual/html_node/emacs/Adaptive-Fill.html#Adaptive-Fill

You can specify more complex ways of choosing a fill prefix automatically by setting the variable adaptive-fill-function to a function.

@holtzermann17
Copy link
Author

holtzermann17 commented Aug 7, 2018

Well, this solves it without writing any code.

M-x package-install RET filladapt RET

(require 'filladapt)
(add-hook 'lean-mode-hook #'filladapt-mode)

@holtzermann17
Copy link
Author

Actually, this is also needed:

(setq filladapt-token-table
      '(("^" beginning-of-line)
        (">+" citation->)
        ("\\(\\w\\|[0-9]\\)[^'`\"< 	
]*>[ 	]*" supercite-citation)
        (";+" lisp-comment)
        ;; Added this line
        ("--" lisp-comment)
        ("#+" sh-comment)
        ("%+" postscript-comment)
        ("///*" c++-comment)
        ("@c[ 	]" texinfo-comment)
        ("@comment[ 	]" texinfo-comment)
        ("\\\\item[ 	]" bullet)
        ("[0-9]+\\.[ 	]" bullet)
        ("[0-9]+\\(\\.[0-9]+\\)+[ 	]" bullet)
        ("[A-Za-z]\\.[ 	]" bullet)
        ("(?[0-9]+)[ 	]" bullet)
        ("(?[A-Za-z])[ 	]" bullet)
        ("[0-9]+[A-Za-z]\\.[ 	]" bullet)
        ("(?[0-9]+[A-Za-z])[ 	]" bullet)
        ("[-~*+]+[ 	]" bullet)
        ("o[ 	]" bullet)
        ("[ 	]+" space)
        ("$" end-of-line)))

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

1 participant