forked from mirrors/org-mode
Merge branch 'master' into gnuplot
This commit is contained in:
commit
e313218ff9
|
@ -190,12 +190,14 @@ the header arguments specified at the source code block."
|
||||||
|
|
||||||
(defun org-babel-get-src-block-name ()
|
(defun org-babel-get-src-block-name ()
|
||||||
"Return the name of the current source block if one exists"
|
"Return the name of the current source block if one exists"
|
||||||
(let ((case-fold-search t))
|
(let ((case-fold-search t)
|
||||||
|
(head (org-babel-where-is-src-block-head)))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (org-babel-where-is-src-block-head))
|
(when head
|
||||||
(if (save-excursion (forward-line -1)
|
(goto-char head)
|
||||||
(looking-at "#\\+srcname:[ \f\t\n\r\v]*\\([^ \f\t\n\r\v]+\\)"))
|
(if (save-excursion (forward-line -1)
|
||||||
(org-babel-clean-text-properties (match-string 1))))))
|
(looking-at "#\\+srcname:[ \f\t\n\r\v]*\\([^ \f\t\n\r\v]+\\)"))
|
||||||
|
(org-babel-clean-text-properties (match-string 1)))))))
|
||||||
|
|
||||||
(defun org-babel-get-src-block-info ()
|
(defun org-babel-get-src-block-info ()
|
||||||
"Return the information of the current source block as a list
|
"Return the information of the current source block as a list
|
||||||
|
@ -308,8 +310,9 @@ source block. Specifically at the beginning of the #+RESNAME:
|
||||||
line. If no result exists for this block then create a
|
line. If no result exists for this block then create a
|
||||||
#+RESNAME: line following the source block."
|
#+RESNAME: line following the source block."
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (org-babel-where-is-src-block-head))
|
(let ((name (org-babel-get-src-block-name))
|
||||||
(let ((name (org-babel-get-src-block-name)) end head)
|
(head (org-babel-where-is-src-block-head)) end)
|
||||||
|
(when head (goto-char head))
|
||||||
(or (and name (message name) (org-babel-find-named-result name))
|
(or (and name (message name) (org-babel-find-named-result name))
|
||||||
(and (re-search-forward "#\\+end_src" nil t)
|
(and (re-search-forward "#\\+end_src" nil t)
|
||||||
(progn (move-end-of-line 1)
|
(progn (move-end-of-line 1)
|
||||||
|
@ -353,7 +356,8 @@ silent -- no results are inserted"
|
||||||
(string-equal (substring result -1) "\r"))))
|
(string-equal (substring result -1) "\r"))))
|
||||||
(setq result (concat result "\n")))
|
(setq result (concat result "\n")))
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(goto-char (org-babel-where-is-src-block-result)) (forward-line 1)
|
(let ((existing-result (org-babel-where-is-src-block-result)))
|
||||||
|
(when existing-result (goto-char existing-result) (forward-line 1)))
|
||||||
(if (stringp result) ;; assume the result is a table if it's not a string
|
(if (stringp result) ;; assume the result is a table if it's not a string
|
||||||
(if (member "file" insert)
|
(if (member "file" insert)
|
||||||
(insert result)
|
(insert result)
|
||||||
|
|
Loading…
Reference in a new issue