-
Notifications
You must be signed in to change notification settings - Fork 163
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
Fix fill-region for code blocks #192
Comments
Thanks, this is definitely interesting and I will take a look. (For my own reference later, I'll just mention that this was related to #169.) |
I tried setting the Another option might be to do some clever tricks in the |
I managed to hack the behavior of |
Sorry for the delay, but sweet! I was just trying this out after reading #251 and its mention of (defun my-gfm-fill (text)
(with-temp-buffer
(gfm-mode)
(insert text)
(font-lock-ensure)
(fill-region (point-min) (point-max))
(buffer-string))) Seems to do the trick 👍 |
As we've discussed,
fill-region
doesn't respect the mode's definition of paragraphs. I'm opening this issue to discuss workaround or other steps forward as this has become quite a nuisance for Magithub (and othermarkdown-mode
-based packages, I'm sure).One possibility I stumbled upon while trying to implement my own fill-function was the use of 'hard' newlines:
It looks like if the newlines in codeblocks are 'hard', then they won't fill. Could we introduce some pre-processing to add that text property to newlines inside code-blocks? Perhaps then
fill-region
will work without any additional futzing.The text was updated successfully, but these errors were encountered: