mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-16 15:56:52 -05:00
lang/org: major refactor of +ipython feature
This commit is contained in:
@@ -50,3 +50,47 @@ string). Stops at the first function to return non-nil.")
|
||||
for p in params
|
||||
if (funcall fn (eq (car p) key))
|
||||
collect p)))
|
||||
|
||||
|
||||
;;
|
||||
;; Plugins
|
||||
;;
|
||||
|
||||
(def-package! ob-ipython
|
||||
:when (featurep! +ipython)
|
||||
:defer t
|
||||
:init
|
||||
(defvar +ob-ipython-local-runtime-dir nil
|
||||
"TODO")
|
||||
|
||||
(setq ob-ipython-resources-dir ".ob-ipython-resrc")
|
||||
|
||||
(defun +org|babel-load-ipython (language)
|
||||
(and (string-match-p "^jupyter-" language)
|
||||
(require 'ob-ipython nil t)))
|
||||
(add-hook '+org-babel-load-functions #'+org|babel-load-ipython)
|
||||
:config
|
||||
(set! :popups
|
||||
'("^\\*Org Src"
|
||||
((size . 100) (side . right) (slot . -1) (window-height . 0.6))
|
||||
((quit) (select . t) (modeline)))
|
||||
'("^\\*Python"
|
||||
((slot . 0) (side . right) (size . 100))
|
||||
((select) (quit) (transient)))
|
||||
'("\\*ob-ipython.*"
|
||||
((slot . 2) (side . right) (size . 100) (window-height . 0.2))
|
||||
((select) (quit) (transient)))
|
||||
'("\\*Python:.*"
|
||||
((slot . 0) (side . right) (size . 100))
|
||||
((select) (quit) (transient))))
|
||||
;; TODO Add more popup styles
|
||||
|
||||
;; advices for remote kernel and org-src-edit
|
||||
(advice-add 'org-babel-edit-prep:ipython :override #'+org*org-babel-edit-prep:ipython)
|
||||
(advice-add 'org-babel-ipython-initiate-session :override #'+org*org-babel-ipython-initiate-session)
|
||||
(advice-add 'ob-ipython--create-repl :override #'+org*ob-ipython--create-repl)
|
||||
(advice-add 'org-babel-execute:ipython :override #'+org*org-babel-execute:ipython)
|
||||
|
||||
;; retina resolution image hack
|
||||
(when (eq window-system 'ns)
|
||||
(advice-add 'ob-ipython--write-base64-string :around #'+org*ob-ipython--write-base64-string)))
|
||||
|
Reference in New Issue
Block a user