mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
jupyter-org--fixed-width-to-example-block: Use jupyter-org--delete-element
This commit is contained in:
parent
7e42bdd80e
commit
2e12acd8e3
1 changed files with 9 additions and 10 deletions
|
@ -715,13 +715,19 @@ is a stream result. Otherwise return nil."
|
|||
|
||||
;;;; Appending stream results
|
||||
|
||||
(defun jupyter-org--delete-element (element)
|
||||
"Delete an `org' ELEMENT from the buffer.
|
||||
Leave its affiliated keywords and preserve and blank lines that
|
||||
appear after the element."
|
||||
(delete-region (or (org-element-property :post-affiliated element)
|
||||
(org-element-property :begin element))
|
||||
(jupyter-org-element-end-before-blanks element)))
|
||||
|
||||
(defun jupyter-org--fixed-width-to-example-block (element result keep-newline)
|
||||
"Replace the fixed-width ELEMENT with an example-block.
|
||||
Append RESULT to the contents of the block. If KEEP-NEWLINE is
|
||||
non-nil, ensure that the appended RESULT begins on a newline."
|
||||
(goto-char (or (org-element-property :post-affiliated element)
|
||||
(org-element-property :begin element)))
|
||||
(delete-region (point) (jupyter-org-element-end-before-blanks element))
|
||||
(jupyter-org--delete-element element)
|
||||
(insert (org-element-interpret-data
|
||||
(jupyter-org-example-block
|
||||
(concat
|
||||
|
@ -840,13 +846,6 @@ Assumes `point' is at the end of the last source block result."
|
|||
;; `org-element-interpret-data' already normalizes the string.
|
||||
(org-element-put-property context :post-blank nil))))))
|
||||
|
||||
(defun jupyter-org--delete-element (element)
|
||||
"Delete an `org' ELEMENT from the buffer.
|
||||
Leave its affiliated keywords and preserve and blank lines that
|
||||
appear after the element."
|
||||
(delete-region (org-element-property :post-affiliated element)
|
||||
(jupyter-org-element-end-before-blanks element)))
|
||||
|
||||
(defun jupyter-org--display-latex (limit)
|
||||
"Show inline latex fragments between LIMIT and `point'."
|
||||
(save-excursion
|
||||
|
|
Loading…
Add table
Reference in a new issue