-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.dir-locals.el
25 lines (24 loc) · 1.4 KB
/
.dir-locals.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
;;; Directory Local Variables -*- no-byte-compile: t -*-
;;; For more information see (info "(emacs) Directory Variables")
((nil . ((eval . (progn
;; install or activate the development environment
;; (requires pyvenv-tracking-mode)
(set (make-local-variable 'my-project)
(locate-dominating-file default-directory ".dir-locals.el"))
(set (make-local-variable 'my-project-venv)
(concat my-project ".venv"))
(if (not (file-exists-p my-project-venv))
(let ((cwd default-directory)
(cmd "make setup"))
(cd my-project)
(async-shell-command cmd)
(cd cwd)
(message
(format "Please re-open this file/directory after the \"%s\" command finishes." cmd)))
;; must be set project-wide for pre-commit to work
(set (make-local-variable 'pyvenv-activate)
my-project-venv))))))
(python-mode . ((eval . (progn
;; sort imports, then style code
(add-hook 'before-save-hook #'py-isort-before-save nil t)
(add-hook 'before-save-hook #'elpy-black-fix-code nil t))))))