1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2025-02-02 20:55:13 +00:00

org-babel: cleaned up code that inserts results

This commit is contained in:
Eric Schulte 2009-09-22 19:49:49 -06:00
parent 24be3cda29
commit 4cb3e3704e

View File

@ -469,8 +469,8 @@ line. If no result exists for this block then create a
;; or (with optional insert) we need to back up and make one ourselves
(when insert
(goto-char end) (open-line 2) (forward-char 1)
(insert (concat "#+resname:" (if name (concat " " name))))
(move-beginning-of-line 1) t)))
(insert (concat "#+resname:" (if name (concat " " name)) "\n"))
(move-beginning-of-line 0) t)))
(point))))))
(defun org-babel-read-result ()
@ -576,27 +576,26 @@ relies on `org-babel-insert-result'."
(interactive)
(save-excursion
(goto-char (org-babel-where-is-src-block-result t)) (forward-line 1)
(delete-region (save-excursion (move-beginning-of-line 0) (point)) (org-babel-result-end))))
(delete-region (point) (org-babel-result-end))))
(defun org-babel-result-end ()
"Return the point at the end of the current set of results"
(save-excursion
(if (org-at-table-p)
(progn (goto-char (org-table-end)) (forward-line 1) (point))
(progn (goto-char (org-table-end)) (point))
(let ((case-fold-search t))
(cond
((looking-at "#\\+begin_latex")
(search-forward "#+end_latex" nil t)
(forward-line 2))
(forward-line 1))
((looking-at "#\\+begin_html")
(search-forward "#+end_html" nil t)
(forward-line 2))
(forward-line 1))
((looking-at "#\\+begin_example")
(search-forward "#+end_example" nil t)
(forward-line 2))
(forward-line 1))
(t (progn (while (looking-at "\\(: \\|\\[\\[\\)")
(forward-line 1))
(forward-line 1)))))
(forward-line 1))))))
(point))))
(defun org-babel-result-to-file (result)