mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
jupyter-org--append-result: Handle appending to a table result
This commit is contained in:
parent
ee1078d0c7
commit
70f0429e07
1 changed files with 18 additions and 5 deletions
|
@ -1095,11 +1095,24 @@ in the drawer. Otherwise do nothing."
|
|||
;; Append everything else
|
||||
(t
|
||||
(jupyter-org--goto-result-insertion-point context)
|
||||
;; Don't delete the current result if its a drawer or if there aren't
|
||||
;; any results yet, in this case the context is just the #+RESULTS:
|
||||
;; keyword.
|
||||
(unless (memq (org-element-type context) '(keyword drawer))
|
||||
(jupyter-org--delete-element context))
|
||||
(cl-case (org-element-type context)
|
||||
;; Don't delete the current result if its a drawer or if there
|
||||
;; aren't any results yet, in this case the context is just the
|
||||
;; #+RESULTS: keyword.
|
||||
((keyword drawer))
|
||||
;; The `org-element-contents' of a table is nil which interferes
|
||||
;; with how `org-element-table-interpreter' works when calling
|
||||
;; `org-element-interpret-data' below.
|
||||
(table
|
||||
(org-element-set-contents
|
||||
context
|
||||
(delete-and-extract-region
|
||||
(org-element-property :contents-begin context)
|
||||
(jupyter-org-element-end-before-blanks context))))
|
||||
;; Any other element is the first result that is being appended to,
|
||||
;; so delete it from the buffer since it will be wrapped in a
|
||||
;; drawer along with the appended result.
|
||||
(t (jupyter-org--delete-element context)))
|
||||
(let ((limit (point)))
|
||||
(insert (org-element-interpret-data
|
||||
(jupyter-org--wrap-result-maybe
|
||||
|
|
Loading…
Add table
Reference in a new issue