mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-05 07:41:37 -05:00
jupyter-org--wrap-result-maybe: Use cond
This commit is contained in:
parent
87bd83c99b
commit
44e3823a93
1 changed files with 15 additions and 14 deletions
|
@ -1130,20 +1130,21 @@ appear after the element."
|
||||||
|
|
||||||
(defun jupyter-org--wrap-result-maybe (context result)
|
(defun jupyter-org--wrap-result-maybe (context result)
|
||||||
"Depending on CONTEXT, wrap RESULT in a drawer."
|
"Depending on CONTEXT, wrap RESULT in a drawer."
|
||||||
;; If a keyword is the context, this is the first result.
|
(cond
|
||||||
(if (eq (org-element-type context) 'keyword)
|
((eq (org-element-type context) 'keyword)
|
||||||
;; Only wrap the result if it can't be removed by `org-babel'.
|
;; Only wrap the result if it can't be removed by `org-babel'.
|
||||||
(if (jupyter-org-babel-result-p result) result
|
(if (jupyter-org-babel-result-p result) result
|
||||||
(jupyter-org-results-drawer result))
|
(jupyter-org-results-drawer result)))
|
||||||
(if (jupyter-org--wrappable-element-p context)
|
((jupyter-org--wrappable-element-p context)
|
||||||
(prog1 (jupyter-org-results-drawer context result)
|
(prog1 (jupyter-org-results-drawer context result)
|
||||||
;; Ensure that a #+RESULTS: line is not prepended to context
|
;; Ensure that a #+RESULTS: line is not prepended to context when calling
|
||||||
;; when calling `org-element-interpret-data'.
|
;; `org-element-interpret-data'.
|
||||||
(org-element-put-property context :results nil)
|
(org-element-put-property context :results nil)
|
||||||
;; Ensure there is no post-blank since
|
;; Ensure there is no post-blank since `org-element-interpret-data'
|
||||||
;; `org-element-interpret-data' already normalizes the string.
|
;; already normalizes the string.
|
||||||
(org-element-put-property context :post-blank nil))
|
(org-element-put-property context :post-blank nil)))
|
||||||
result)))
|
(t
|
||||||
|
result)))
|
||||||
|
|
||||||
;;;; Stream results
|
;;;; Stream results
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue