Skip to content

Commit

Permalink
Merge pull request #61 from gopar/master
Browse files Browse the repository at this point in the history
Add hook to move to virtualenv directory if chosen
  • Loading branch information
porterjamesj authored Feb 12, 2018
2 parents cf3ae3f + d4e9005 commit bf13158
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 @@ -228,9 +228,17 @@ prompting the user with the string PROMPT"
;; keep eshell path in sync
(setq eshell-path-env 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 bf13158

Please sign in to comment.