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

Does apheleia support formatting of narrowed buffer? #43

Open
dvzubarev opened this issue Jul 30, 2021 · 2 comments
Open

Does apheleia support formatting of narrowed buffer? #43

dvzubarev opened this issue Jul 30, 2021 · 2 comments

Comments

@dvzubarev
Copy link

Hi, thank you for this package.
I use python black formatter and one day I wanted to edit narrowed region.

class A:
    pass

|class B:
    pass|

class C:
    pass

Select the code inside | call M-x narrow-to-region - you will see only:

class B:
    pass

After editing and saving the narrowed buffer - the code disappears.
Call M-x widen and the content of the buffer will be

class A:
    pass



class C:
    pass

Emacs 27.1, apheleia-20210723.516

@raxod502
Copy link
Member

Hey @dvzubarev, sorry for the delayed response. At the moment this isn't supported, but it's definitely a feature I would be happy to see incorporated. I don't think it would be tremendously difficult, we probably just need to be a little more careful with how the formatting code interacts with the current buffer restriction. There's also of course the restriction that for formatters that require operating on the original file in-place in the project, we will end up formatting the entire buffer whether it's narrowed or not.

@dvzubarev
Copy link
Author

Thank you for your response. FWIW I remember that I made quick experiments with replace-buffer-contents (#38) and it seems to work fine with narrowed buffers.

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

No branches or pull requests

2 participants