Skip to content

Commit

Permalink
Move to virtualenv directory if chosen
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Gopar committed Feb 11, 2018
1 parent 5649028 commit d4e9005
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions virtualenvwrapper.el
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,17 @@ prompting the user with the string PROMPT"
;; keep eshell path in sync
(setq eshell-path-env (getenv "PATH"))
(setenv "VIRTUAL_ENV" venv-current-dir)
(venv--switch-to-project-dir)
(venv--set-venv-gud-pdb-command-name)
(run-hooks 'venv-postactivate-hook))

(defun venv--switch-to-project-dir ()
"If we find the project file, cd into that directory"
(let ((proj-file (expand-file-name ".project" venv-current-dir)))
(when (file-exists-p proj-file)
(cd (with-temp-buffer
(insert-file-contents proj-file)
(string-trim (buffer-string)))))))

;; potentially interactive user-exposed functions

Expand Down

0 comments on commit d4e9005

Please sign in to comment.