lassik / emacs-format-all-the-code

Auto-format source code in many languages with one command
https://melpa.org/#/format-all
MIT License
605 stars 105 forks source link

TODO: Validate formatter names #160

Open lassik opened 3 years ago

lassik commented 3 years ago

If you do:

(setq format-all-formatters '(("HTML" no-such-formatter)))

and then run M-x format-all-buffer, you get the confusing error:

Debugger entered--Lisp error: (void-function nil)
  nil(nil "HTML" nil)
  funcall(nil nil "HTML" nil)

That's because format-all doesn't check if the formatter exists. We should.

We should also ensure that command line arguments are not passed to a formatter that doesn't run an external program. For example, you can't pass command line arguments to the Emacs Lisp formatter.