use-package
use-package copied to clipboard
Failed to add hooks like this: `(python-mode . (flycheck-mode company-mode))`.
I install and manage the python-mode
package via use-package
and have the following configuration in :hooks
section:
:hook
(python-mode . flycheck-mode)
(python-mode . company-mode)
[...]
If I combine the above two hook lines into this one: (python-mode . (flycheck-mode company-mode))
, the following error will be triggered during Emacs startup:
Error in post-command-hook (global-company-mode-check-buffers): (error "Lisp nesting exceeds ‘max-lisp-eval-depth’")
Why doesn't use-package
support this type of hook combination?
Regards, HZ
Does it not make more sense to include these hooks to python-mode
in the use-package
forms for flycheck
and company
. That is:
(use-package company
:hook (python-mode . company-mode))
(use-package flycheck
:hook (python-mode . flycheck-mode))
However, I think you would be better served by hooking into prog-mode
rather than python-mode
.
(use-package company
:hook (prog-mode . company-mode))
(use-package flycheck
:hook (prog-mode . flycheck-mode))
@hongyi-zhao Your suggestion makes sense to me.