Skip to content

Instantly share code, notes, and snippets.

@mpcogito
Last active February 6, 2021 15:19
Show Gist options
  • Save mpcogito/d6f2a2fb5595bf10e6109143071eee5b to your computer and use it in GitHub Desktop.
Save mpcogito/d6f2a2fb5595bf10e6109143071eee5b to your computer and use it in GitHub Desktop.
Fix pipenv nesting issue
;; ~/.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