lang/python: load anaconda-mode a little sooner

So its hooks take effect in the first buffer.
This commit is contained in:
Henrik Lissner 2019-07-28 02:38:27 +02:00
parent a6d77e951f
commit 26f9e2cdeb
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -84,14 +84,10 @@ called.")
(use-package! anaconda-mode (use-package! anaconda-mode
:defer t :after python
:init :init
(setq anaconda-mode-installation-directory (concat doom-etc-dir "anaconda/") (setq anaconda-mode-installation-directory (concat doom-etc-dir "anaconda/")
anaconda-mode-eldoc-as-single-line t) anaconda-mode-eldoc-as-single-line t)
(add-hook! 'python-mode-local-vars-hook
(defun +python-init-anaconda-mode-maybe-h ()
(unless (bound-and-true-p lsp-mode)
(anaconda-mode +1))))
:config :config
(add-hook 'anaconda-mode-hook #'anaconda-eldoc-mode) (add-hook 'anaconda-mode-hook #'anaconda-eldoc-mode)
(set-company-backend! 'anaconda-mode '(company-anaconda)) (set-company-backend! 'anaconda-mode '(company-anaconda))
@ -101,6 +97,12 @@ called.")
:documentation #'anaconda-mode-show-doc) :documentation #'anaconda-mode-show-doc)
(set-popup-rule! "^\\*anaconda-mode" :select nil) (set-popup-rule! "^\\*anaconda-mode" :select nil)
(add-hook! 'python-mode-local-vars-hook
(defun +python-init-anaconda-mode-maybe-h ()
"Enable `anaconda-mode' if `lsp-mode' isn't."
(unless (bound-and-true-p lsp-mode)
(anaconda-mode +1))))
(defun +python-auto-kill-anaconda-processes-h () (defun +python-auto-kill-anaconda-processes-h ()
"Kill anaconda processes if this buffer is the last python buffer." "Kill anaconda processes if this buffer is the last python buffer."
(when (and (eq major-mode 'python-mode) (when (and (eq major-mode 'python-mode)