@@ -1225,7 +1225,7 @@ If a match is not found, return nil."
1225
1225
(memq type org-element-all-objects)
1226
1226
(memq type org-element-all-elements)))))
1227
1227
1228
- (cl-defmethod jupyter-org-result (( req jupyter-org-request) plist &optional metadata)
1228
+ (defun jupyter-org-get- result (req plist &optional metadata )
1229
1229
" For REQ, return a rendered form of a message PLIST.
1230
1230
PLIST and METADATA have the same meaning as in
1231
1231
`jupyter-normalize-data' .
@@ -1249,26 +1249,25 @@ If the source block parameters have a value for the :display
1249
1249
header argument, like \" image/png html plain\" , then loop over
1250
1250
those mime types instead."
1251
1251
(if (jupyter-org-element-p plist) plist
1252
- (let* ((mime-types (jupyter-org-display-mime-types req))
1253
- (params (jupyter-org-request-block-params req)))
1254
- (cl-assert plist json-plist)
1255
- ; ; Push :file back into PARAMS if it was present in
1256
- ; ; `org-babel-execute:jupyter' . That function removes it because
1257
- ; ; we don't want `org-babel-insert-result' to handle it.
1258
- (when (jupyter-org-request-file req)
1259
- (push (cons :file (jupyter-org-request-file req)) params))
1260
- (or (jupyter-org-with-point-at req
1261
- (jupyter-map-mime-bundle mime-types
1262
- (jupyter-normalize-data plist metadata)
1263
- (lambda (mime content )
1264
- (jupyter-org-result mime content params))))
1265
- (let ((warning
1266
- (format
1267
- " %s did not return requested mimetype(s): %s"
1268
- (jupyter-message-type (jupyter-request-last-message req))
1269
- mime-types)))
1270
- (display-warning 'jupyter warning )
1271
- nil )))))
1252
+ (pcase-let (((cl-struct jupyter-org-request block-params file) req))
1253
+ (let* ((mime-types (jupyter-org-display-mime-types req)))
1254
+ ; ; Push :file back into PARAMS if it was present in
1255
+ ; ; `org-babel-execute:jupyter' . That function removes it because
1256
+ ; ; we don't want `org-babel-insert-result' to handle it.
1257
+ (when file
1258
+ (push (cons :file file) block-params))
1259
+ (or (jupyter-org-with-point-at req
1260
+ (jupyter-map-mime-bundle mime-types
1261
+ (jupyter-normalize-data plist metadata)
1262
+ (lambda (mime content )
1263
+ (jupyter-org-result mime content block-params))))
1264
+ (let ((warning
1265
+ (format
1266
+ " %s did not return requested mimetype(s): %s"
1267
+ (jupyter-message-type (jupyter-request-last-message req))
1268
+ mime-types)))
1269
+ (display-warning 'jupyter warning )
1270
+ nil ))))))
1272
1271
1273
1272
(cl-defmethod jupyter-org-result ((_mime (eql :application/vnd .jupyter.widget-view+json)) _content _params)
1274
1273
; ; TODO: Clickable text to open up a browser
@@ -1775,7 +1774,7 @@ If INDENTATION is nil, it defaults to `current-indentation'."
1775
1774
(pcase-let (((cl-struct jupyter-org-request
1776
1775
inline-block-p block-params client)
1777
1776
req))
1778
- (let ((result (jupyter-org-result req data metadata)))
1777
+ (let ((result (jupyter-org-get- result req data metadata)))
1779
1778
(jupyter-org-with-point-at req
1780
1779
(if inline-block-p
1781
1780
(org-babel-insert-result
@@ -1859,7 +1858,7 @@ EL is an Org element with the properties
1859
1858
(cond
1860
1859
(async-p
1861
1860
(jupyter-org--clear-async-indicator req)
1862
- (if silent-p (jupyter-return (jupyter-org-result req data metadata))
1861
+ (if silent-p (jupyter-return (jupyter-org-get- result req data metadata))
1863
1862
(jupyter-org-inserted-result data metadata)))
1864
1863
(t
1865
1864
(jupyter-return
@@ -1959,7 +1958,7 @@ Meant to be used as the return value of
1959
1958
(jupyter-org-strip-last-newline r))
1960
1959
r))
1961
1960
(jupyter-org--process-pandoc-results
1962
- (mapcar (apply-partially #'jupyter-org-result req)
1961
+ (mapcar (apply-partially #'jupyter-org-get- result req)
1963
1962
results))))
1964
1963
(result-params (alist-get :result-params block-params)))
1965
1964
(org-element-interpret-data
0 commit comments