Error (prog-mode-hook): Error running hook "format-all-ensure-formatter" because: (void-function format-all-ensure-formatter)
Closed this issue · 7 comments
I'm pretty new to emacs to excuse my lack of knowledge if this is a simple fix.
But in my config:
(add-hook 'prog-mode-hook 'format-all-mode)
(with-eval-after-load 'format-all
(add-hook 'prog-mode-hook 'format-all-ensure-formatter))
But this outputs the error:
Error (prog-mode-hook): Error running hook "format-all-ensure-formatter" because: (void-function format-all-ensure-formatter)
Is there something wrong?
Sorry, I don't understand why it doesn't work. There's nothing obviously wrong with your example.
Putting (require 'format-all)
before the add-hook
calls should fix it, but that's kind of a brute-force solution since it will try (and fail) to load format-all even on computers where you don't have it installed.
This might also work, and shouldn't fail on computers where format-all isn't installed:
(when (require 'format-all nil t)
(add-hook 'prog-mode-hook 'format-all-mode)
(add-hook 'prog-mode-hook 'format-all-ensure-formatter))
Hmm i still get the same error after trying both suggestions
Are you using Doom Emacs by any chance?
Unfortunately I can't help with Doom problems since they are using a customized version of format-all. Please try their issue tracker. Good luck!
No worries! Thanks