mirror of
https://github.com/vale981/emacs-ipython-notebook
synced 2025-03-06 09:31:39 -05:00
Cleaner ein:notebook-console-open
See also: https://github.com/fgallina/python.el/issues/85
This commit is contained in:
parent
b38c03c506
commit
28c23d1f36
1 changed files with 8 additions and 3 deletions
|
@ -1352,6 +1352,11 @@ Types same as `ein:notebook-console-security-dir' are valid."
|
||||||
(ein:choose-setting 'ein:notebook-console-args
|
(ein:choose-setting 'ein:notebook-console-args
|
||||||
(ein:$notebook-url-or-port notebook)))
|
(ein:$notebook-url-or-port notebook)))
|
||||||
|
|
||||||
|
;; `Fabian Gallina's python.el`_
|
||||||
|
(declare-function run-python "python")
|
||||||
|
(declare-function python-shell-parse-command "python")
|
||||||
|
(declare-function python-shell-switch-to-shell "python")
|
||||||
|
|
||||||
(defun ein:notebook-console-open ()
|
(defun ein:notebook-console-open ()
|
||||||
"Open IPython console.
|
"Open IPython console.
|
||||||
To use this function, `ein:notebook-console-security-dir' and
|
To use this function, `ein:notebook-console-security-dir' and
|
||||||
|
@ -1370,6 +1375,7 @@ It should be possible to support python-mode.el. Patches are welcome!
|
||||||
(ein:$notebook-kernel ein:notebook)))
|
(ein:$notebook-kernel ein:notebook)))
|
||||||
(ipy (ein:notebook-console-executable-get ein:notebook))
|
(ipy (ein:notebook-console-executable-get ein:notebook))
|
||||||
(args (ein:notebook-console-args-get ein:notebook))
|
(args (ein:notebook-console-args-get ein:notebook))
|
||||||
|
;; python.el settings:
|
||||||
(python-shell-setup-codes nil)
|
(python-shell-setup-codes nil)
|
||||||
(python-shell-interpreter
|
(python-shell-interpreter
|
||||||
(format "python %s console --existing %skernel-%s.json %s"
|
(format "python %s console --existing %skernel-%s.json %s"
|
||||||
|
@ -1377,9 +1383,8 @@ It should be possible to support python-mode.el. Patches are welcome!
|
||||||
;; python.el makes dedicated process when
|
;; python.el makes dedicated process when
|
||||||
;; `buffer-file-name' has some value.
|
;; `buffer-file-name' has some value.
|
||||||
(buffer-file-name (buffer-name)))
|
(buffer-file-name (buffer-name)))
|
||||||
;; Automatically answer y to the question "Make dedicated process?"
|
(run-python t (python-shell-parse-command))
|
||||||
(flet ((y-or-n-p (prompt) t))
|
(python-shell-switch-to-shell))
|
||||||
(funcall 'python-shell-switch-to-shell)))
|
|
||||||
(ein:log 'warn "python.el is not loaded!")))
|
(ein:log 'warn "python.el is not loaded!")))
|
||||||
|
|
||||||
(provide 'ein-notebook)
|
(provide 'ein-notebook)
|
||||||
|
|
Loading…
Add table
Reference in a new issue