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

Need a global mode to toggle format-all-mode #136

Open
c02y opened this issue Apr 23, 2021 · 2 comments
Open

Need a global mode to toggle format-all-mode #136

c02y opened this issue Apr 23, 2021 · 2 comments

Comments

@c02y
Copy link

c02y commented Apr 23, 2021

  1. when toggle global-format-all-mode on, it it what it is right now
  2. when toggle global-format-all-mode off, it is turned off for the rest of emacs session until you toggle it on, if you don't toggle it on, it is always off when you switch to another buffer or open a new buffer. I need this since I got several files to be edited but I want format-all-mode off for all of them, so I don't need to remember to turn it off for every new open file.
@lassik
Copy link
Owner

lassik commented Apr 25, 2021

format-all-mode is off by default (unless you turn it on in prog-mode-hook as many people do).

A global mode could be useful, but it's not easy to figure out how exactly to do it. Currently format-all doesn't do any formatting in buffers where format-all-formatters is nil. This means that a global format-all-mode would work fine, skipping those buffers.

But then people would have to call format-all-ensure-formatter in the buffers that they do want to format. That could be added to a hook function to make it automatic.

If anyone is reading and has any ideas, please let us know!

@c02y
Copy link
Author

c02y commented Apr 25, 2021

I already turn format-all-mode on:

    (add-hook 'prog-mode-hook 'format-all-mode)
    (with-eval-after-load 'format-all
      (add-hook 'prog-mode-hook 'format-all-ensure-formatter))

But when I edit other people's code, I need to turn the format-all-mode for the whole session.

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

2 participants