From a6fb279965aa6c09fc1b26fb26d0aa290cff1543 Mon Sep 17 00:00:00 2001 From: Taylor Bockman Date: Wed, 10 Jun 2020 17:12:27 -0700 Subject: [PATCH] Python tk export and pyenv-mode for emacs --- dotfiles/bash/bash_profile | 1 + dotfiles/emacs.d/init.el | 23 +++++++++++++++++++++-- dotfiles/emacs.d/package.el | 5 ++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/dotfiles/bash/bash_profile b/dotfiles/bash/bash_profile index 2d5d229..393190e 100644 --- a/dotfiles/bash/bash_profile +++ b/dotfiles/bash/bash_profile @@ -7,3 +7,4 @@ export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ export PATH="/usr/local/opt/openjdk/bin:$PATH" export PATH="/usr/local/opt/llvm/bin:$PATH" export PATH="/usr/local/opt/qt/bin:$PATH" +export PATH="/usr/local/opt/tcl-tk/bin:$PATH" diff --git a/dotfiles/emacs.d/init.el b/dotfiles/emacs.d/init.el index 97966c6..b1596f0 100644 --- a/dotfiles/emacs.d/init.el +++ b/dotfiles/emacs.d/init.el @@ -187,8 +187,16 @@ There are two things you can do about this warning: ;; For Python enable Elpy. (use-package elpy - :ensure t - :init (elpy-enable)) + :ensure t + :init (elpy-enable)) + +;; Enable pyenv integration. +(use-package pyenv-mode + :config + (pyenv-mode)) + +;; Disable elpy default virtualenv (use the pyenv one) +(setq elpy-rpc-virtualenv-path 'current) ;;-------------------------------------------------------------------------------------- ;; Save hooks @@ -196,6 +204,17 @@ There are two things you can do about this warning: (add-hook 'before-save-hook 'delete-trailing-whitespace) +;; Automagically enable the right pyenv if a .python-version exists +(defun ssbb-pyenv-hook () + "Automatically activates pyenv version if .python-version file exists." + (f-traverse-upwards + (lambda (path) + (let ((pyenv-version-path (f-expand ".python-version" path))) + (if (f-exists? pyenv-version-path) + (pyenv-mode-set (s-trim (f-read-text pyenv-version-path 'utf-8)))))))) + + + ;;-------------------------------------------------------------------------------------- ;; Keybinds ;;-------------------------------------------------------------------------------------- diff --git a/dotfiles/emacs.d/package.el b/dotfiles/emacs.d/package.el index 536796b..35aecf0 100644 --- a/dotfiles/emacs.d/package.el +++ b/dotfiles/emacs.d/package.el @@ -79,9 +79,12 @@ rtags company-rtags + ;; Environments + pyenv-mode + ;;General use-package - + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; )