emacs-format-all-the-code icon indicating copy to clipboard operation
emacs-format-all-the-code copied to clipboard

Change to separate customizations for formatters

Open mzuther opened this issue 4 years ago • 3 comments

Hi!

I just stumbled on issue #131 and thought about your comment:

Wow, we should really find a way to make it easier to configure format-all.

When using Emacs' customization dialogs, currently a huge list of formatters is saved. Without looking at your code, I see the following problem:

  1. it's not straight-forward to customize a single formatter
  2. users with customized formatters won't be able to see and use formatters newly introduced by updates
  3. or you'll have to add a lot of code to ensure that 2. does not happen

In other words, you have acquired some code debt. :smile:

I therefore suggest that you move from format-all-default-formatters to separate customizations such as format-all-formatter-python. This sounds like a nice task for LISP macros, although I'm not too familiar with elisp.

Best,

Martin

mzuther avatar Apr 01 '21 09:04 mzuther

I agree that's the best move.

  • format-all-default-formatter-for-python
  • format-all-default-formatter-for-ruby
  • ...

That lets people choose from a menu as well. The Python setting can have a menu of black and yapf.

lassik avatar Apr 01 '21 09:04 lassik

format-all-formatters should still stay for fine-grained control.

lassik avatar Apr 01 '21 09:04 lassik

Still haven't got around to this :-/ If anyone wants to try their hand at a PR, please let me know.

lassik avatar Apr 27 '21 20:04 lassik