Last active
February 6, 2021 15:19
-
-
Save mpcogito/d6f2a2fb5595bf10e6109143071eee5b to your computer and use it in GitHub Desktop.
Fix pipenv nesting issue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; ~/.spacemacs.d/init.el | |
;; ... | |
;; IMPORTANT: Make sure python-pipenv-activate is nil, or modify the below code. | |
(defun dotspacemacs/user-config () | |
;; ... | |
;; fix nested pipenv module problem | |
(advice-add 'pipenv--command :around #'mikemacs/my-setup-pipenv-default-directory) | |
;; ... | |
) | |
(defun mikemacs/my-setup-pipenv-default-directory (orig-fun &rest args) | |
"Workaround to set default directory before calling pipenv functions. | |
Needed because pipenv can't handle deeply nested modules." | |
(let ((default-directory (or (pipenv-project?) default-directory))) | |
(message "Advising pipenv to use directory %S" default-directory) | |
(apply orig-fun args))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment