lang/python: kill anaconda processes after killing last python buffer

This commit is contained in:
Henrik Lissner 2018-01-31 05:32:05 -05:00
parent e16ec5ae94
commit 4dbca5b21f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -84,7 +84,16 @@ environment variables."
:definition #'anaconda-mode-find-definitions
:references #'anaconda-mode-find-references
:documentation #'anaconda-mode-show-doc)
(advice-add #'anaconda-mode-doc-buffer :after #'doom*anaconda-mode-doc-buffer))
(advice-add #'anaconda-mode-doc-buffer :after #'doom*anaconda-mode-doc-buffer)
(defun +python|auto-kill-anaconda-processes ()
"Kill anaconda processes if this buffer is the last python buffer."
(when (and (eq major-mode 'python-mode)
(not (delq (current-buffer)
(doom-buffers-in-mode 'python-mode (buffer-list)))))
(anaconda-mode-stop)))
(add-hook! 'python-mode-hook
(add-hook 'kill-buffer-hook #'+python|auto-kill-anaconda-processes nil t)))
(def-package! company-anaconda