Skip to content
Open
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
29 changes: 18 additions & 11 deletions ob-ipython.el
Original file line number Diff line number Diff line change
Expand Up @@ -501,17 +501,24 @@ a new kernel will be started."
"Return a list of available jupyter kernels and their corresponding languages.
The elements of the list have the form (\"kernel\" \"language\")."
(and ob-ipython-command
(let ((kernelspecs (cdar (json-read-from-string
(shell-command-to-string
(s-concat ob-ipython-command " kernelspec list --json"))))))
(-map (lambda (spec)
(cons (symbol-name (car spec))
(->> (cdr spec)
(assoc 'spec)
cdr
(assoc 'language)
cdr)))
kernelspecs))))
(let*
((kernelspecs-cmd (s-concat ob-ipython-command " kernelspec list --json"))
(kernelspecs-text (shell-command-to-string kernelspecs-cmd))
(kernelspecs
(condition-case-unless-debug nil
(cdar (json-read-from-string kernelspecs-text))
(json-readtable-error
(message "Failed to list jupyter kernels with: %s, got:\n%s" kernelspecs-cmd kernelspecs-text)
nil))))
(when kernelspecs
(-map (lambda (spec)
(cons (symbol-name (car spec))
(->> (cdr spec)
(assoc 'spec)
cdr
(assoc 'language)
cdr)))
kernelspecs)))))

(defun ob-ipython--configure-kernel (kernel-lang)
"Configure org mode to use specified kernel."
Expand Down