-
Notifications
You must be signed in to change notification settings - Fork 107
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
Use replace-buffer-contents to reformat buffer #124
base: master
Are you sure you want to change the base?
Conversation
074d6e6
to
c06f76d
Compare
I'm not user of |
@BlankSpruce Thanks. Good to know that this improves origami and possibly vimish-fold. The PR linked by @Thisch points out that |
@Thisch Thanks for pointing that out. I've just checked how And what's worse this new fold can't reopened. So I guess The current solution at least doesn't bring any surprises in contrast to |
User might want to preserve some properties of the buffer after reformatting which can be done by customizing `format-all-reformat-buffer-function`.
c06f76d
to
d85d8b8
Compare
I've pushed another proposal. How about letting user decide how they want their buffer to be reformatted? By default it will be the current, fast implementation but they might either choose some other function defined in |
I agree that users should have a choice since there is no one obvious right way to do it. But users of packages like reformatter and many others will be facing essentially the same choice so it would be good to have one package where to make that choice. Let's wait for @purcell's opinion and maybe we can work something out that solves everyone's problem. |
Just noticed this package by @raxod502 which takes a very interesting approach: https://github.com/raxod502/apheleia |
@BlankSpruce Thanks for looking into it in detail. We should ask origami's author for advice; he is likely an expert on this stuff. |
According to
replace-buffer-contents
documentation this functionreplaces buffer contents in smarter way. Especially interesting part:
One example where some properties are preserved is when origami-mode
is used on the buffer to collapse some regions. After this change
collapsed regions stay collapsed after reformatting