Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,13 @@ Activate python virtual environment. Tramp paths are supported.
### pythonic-deactivate

Deactivate python virtual environment.


## Project overrides with .dir-locals
You can change the default docker file and set a default
container to run the pythonic commands in with these dir-locals.

```lisp
((python . ((pythonic-docker-compose-filename . "local.yml")
(pythonic-docker-compose-container-name . "footprint"))))
```
6 changes: 5 additions & 1 deletion pythonic.el
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ format."
;;; Docker Compose.

(defvar pythonic-docker-compose-filename "docker-compose.yml")
(defvar pythonic-docker-compose-container-name nil)

(defvar pythonic-read-docker-compose-file-code "
from __future__ import print_function
Expand Down Expand Up @@ -208,6 +209,7 @@ print(json.dumps(yaml.safe_load(open(sys.argv[-1], 'r'))))

(defun pythonic-set-docker-compose-alias ()
"Build alias string for current docker-compose project."
(hack-dir-local-variables-non-file-buffer)
(unless
(or (tramp-tramp-file-p default-directory)
(pythonic-has-alias-p default-directory))
Expand All @@ -220,7 +222,9 @@ print(json.dumps(yaml.safe_load(open(sys.argv[-1], 'r'))))
;; should appears once in the selection and all volumes
;; should be added to the alias list.
(volume (if (< 1 (length volumes))
(assoc (completing-read "Service: " (mapcar 'car volumes) nil t) volumes)
(if pythonic-docker-compose-container-name
pythonic-docker-compose-container-name
(assoc (completing-read "Service: " (mapcar 'car volumes) nil t) volumes))
(car volumes)))
(service (car volume))
(sub-project (f-join project (cadr volume)))
Expand Down