emacs-format-all-the-code
emacs-format-all-the-code copied to clipboard
Need a global mode to toggle format-all-mode
- when toggle
global-format-all-modeon, it it what it is right now - when toggle
global-format-all-modeoff, 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.
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!
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.