Naming convention and add docs; Avoid conflicting pyenv.
This commit is contained in:
parent
fada449bd4
commit
732c2979c4
2 changed files with 18 additions and 11 deletions
|
@ -8,11 +8,11 @@
|
|||
(defvar +python-conda-home '("~/.anaconda3" "/usr/bin/anaconda3" "~/.anaconda")
|
||||
"A list of host pattern and corresponding anaconda home.")
|
||||
:config
|
||||
(advice-add 'anaconda-mode-bootstrap :override #'*anaconda-mode-bootstrap)
|
||||
(advice-add 'anaconda-mode-bootstrap :override #'+python*anaconda-mode-bootstrap)
|
||||
(conda-env-autoactivate-mode -1)
|
||||
;; (add-hook 'python-mode-hook #'conda-env-activate-for-buffer)
|
||||
(conda-env-initialize-interactive-shells)
|
||||
(conda-env-initialize-eshell)
|
||||
;; Version management with conda
|
||||
(add-hook 'conda-postactivate-hook #'+python|add-version-to-modeline)
|
||||
(add-hook 'conda-postdeactivate-hook #'+python|add-version-to-modeline))
|
||||
(add-hook 'conda-postactivate-hook #'+python|add-conda-env-to-modeline)
|
||||
(add-hook 'conda-postdeactivate-hook #'+python|add-conda-env-to-modeline))
|
||||
|
|
|
@ -3,21 +3,28 @@
|
|||
|
||||
;;;###autoload
|
||||
(defun +python/set-conda-home ()
|
||||
(interactive)
|
||||
(ivy-read "Set conda home:" +python-conda-home
|
||||
:history +python/set-conda-home--history
|
||||
:action (lambda (cand) (setq conda-anaconda-home cand))))
|
||||
"Set the CONDA HOME.
|
||||
Usually it's `~/.anaconda3' on local machine, but you can also set it to a
|
||||
remote directory using TRAMP syntax such as `/ssh:host:/usr/bin/anaconda3'. In
|
||||
that way you can use the remote conda environment as well as the corresponding
|
||||
remote python executable and packages."
|
||||
(interactive)
|
||||
(ivy-read "Set conda home:" +python-conda-home
|
||||
:history +python/set-conda-home--history
|
||||
:action (lambda (cand) (setq conda-anaconda-home cand))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +python|add-version-to-modeline ()
|
||||
"Add version string to the major mode in the modeline."
|
||||
(defun +python|add-conda-env-to-modeline ()
|
||||
"Add conda environment string to the major mode in the modeline."
|
||||
(setq mode-name
|
||||
(if conda-env-current-name
|
||||
(format "Py:conda:%s" conda-env-current-name)
|
||||
"Python")))
|
||||
;;;###autoload
|
||||
(defun *anaconda-mode-bootstrap (&optional callback)
|
||||
"Run `anaconda-mode' server.
|
||||
(defun +python*anaconda-mode-bootstrap (&optional callback)
|
||||
"Advice to set up the anaconda-mode even in remote environment.
|
||||
Original doc:
|
||||
Run `anaconda-mode' server.
|
||||
CALLBACK function will be called when `anaconda-mode-port' will
|
||||
be bound."
|
||||
(setq anaconda-mode-process
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue