Skip to content

Commit 69b812c

Browse files
aiguoferproofit404
authored andcommitted
Allow using a different interpreter through pythonic-interpreter var (#13)
1 parent 16c1620 commit 69b812c

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

README.markdown

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,11 @@ directory.
133133
((python . ((pythonic-docker-compose-filename . "local.yml")
134134
(pythonic-docker-compose-service-name . "web"))))
135135
```
136+
137+
You can change the interpreter that pythonic uses. This is especially useful when you have set your `python-shell-interpreter` to something like `jupyter-console`. By default, it'll use `python-shell-interpreter`.
138+
139+
To change it:
140+
141+
```lisp
142+
(setq pythonic-interpreter "python")
143+
```

pythonic.el

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,16 +251,20 @@ print(json.dumps(yaml.safe_load(open(sys.argv[-1], 'r'))))
251251

252252
;;; Processes.
253253

254+
(defvar pythonic-interpreter python-shell-interpreter
255+
"Interpreter to use for pythonic process calls.")
256+
254257
(cl-defun pythonic-call-process (&key file buffer display args cwd)
255258
"Pythonic wrapper around `call-process'.
256259
257260
FILE is the input file. BUFFER is the output destination. DISPLAY
258261
specifies to redisplay BUFFER on new output. ARGS is the list of
262+
259263
arguments passed to `call-process'. CWD will be working directory
260264
for running process."
261265
(let ((default-directory (pythonic-aliased-path (or cwd default-directory))))
262266
(python-shell-with-environment
263-
(apply 'process-file python-shell-interpreter file buffer display args))))
267+
(apply 'process-file pythonic-interpreter file buffer display args))))
264268

265269
(cl-defun pythonic-start-process (&key process buffer args cwd filter sentinel (query-on-exit t))
266270
"Pythonic wrapper around `start-process'.
@@ -274,7 +278,7 @@ function if necessary. QUERY-ON-EXIT will be corresponding
274278
process flag."
275279
(let ((default-directory (pythonic-aliased-path (or cwd default-directory))))
276280
(python-shell-with-environment
277-
(let ((process (apply 'start-file-process process buffer python-shell-interpreter args)))
281+
(let ((process (apply 'start-file-process process buffer pythonic-interpreter args)))
278282
(when filter
279283
(set-process-filter process filter))
280284
(when sentinel

0 commit comments

Comments
 (0)