Skip to content

Commit 4551667

Browse files
vale981nnicandro
authored andcommitted
fix inserting images into the right directory
1 parent 2769bf1 commit 4551667

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

jupyter-org-client.el

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -980,26 +980,27 @@ If the source block parameters have a value for the :display
980980
header argument, like \"image/png html plain\", then loop over
981981
those mime types instead."
982982
(cl-assert plist json-plist)
983-
(let* ((params (jupyter-org-request-block-params req))
984-
(display-mime-types (jupyter-org--find-mime-types
985-
(alist-get :display params))))
986-
;; Push :file back into PARAMS if it was present in
987-
;; `org-babel-execute:jupyter'. That function removes it because
988-
;; we don't want `org-babel-insert-result' to handle it.
989-
(when (jupyter-org-request-file req)
990-
(push (cons :file (jupyter-org-request-file req)) params))
991-
(cond
992-
((jupyter-map-mime-bundle (or display-mime-types jupyter-org-mime-types)
993-
(jupyter-normalize-data plist metadata)
994-
(lambda (mime content)
995-
(jupyter-org-result mime content params))))
996-
(t
997-
(let ((warning
998-
(format
999-
"%s did not return requested mimetype(s): %s"
1000-
(jupyter-message-type (jupyter-request-last-message req))
1001-
(or display-mime-types jupyter-org-mime-types))))
1002-
(display-warning 'jupyter warning))))))
983+
(org-with-point-at (jupyter-org-request-marker req)
984+
(let* ((params (jupyter-org-request-block-params req))
985+
(display-mime-types (jupyter-org--find-mime-types
986+
(alist-get :display params))))
987+
;; Push :file back into PARAMS if it was present in
988+
;; `org-babel-execute:jupyter'. That function removes it because
989+
;; we don't want `org-babel-insert-result' to handle it.
990+
(when (jupyter-org-request-file req)
991+
(push (cons :file (jupyter-org-request-file req)) params))
992+
(cond
993+
((jupyter-map-mime-bundle (or display-mime-types jupyter-org-mime-types)
994+
(jupyter-normalize-data plist metadata)
995+
(lambda (mime content)
996+
(jupyter-org-result mime content params))))
997+
(t
998+
(let ((warning
999+
(format
1000+
"%s did not return requested mimetype(s): %s"
1001+
(jupyter-message-type (jupyter-request-last-message req))
1002+
(or display-mime-types jupyter-org-mime-types))))
1003+
(display-warning 'jupyter warning)))))))
10031004

10041005
(cl-defmethod jupyter-org-result ((_mime (eql :application/vnd.jupyter.widget-view+json)) _content _params)
10051006
;; TODO: Clickable text to open up a browser

0 commit comments

Comments
 (0)