forked from mirrors/org-mode
allow comments between code blocks and un-named res
* lisp/ob-core.el (org-babel-where-is-src-block-result): Allow comments between code blocks and un-named results.
This commit is contained in:
parent
90faed3672
commit
a461b0a444
|
@ -1807,21 +1807,26 @@ following the source block."
|
||||||
(progn (end-of-line 1)
|
(progn (end-of-line 1)
|
||||||
(if (eobp) (insert "\n") (forward-char 1))
|
(if (eobp) (insert "\n") (forward-char 1))
|
||||||
(setq end (point))
|
(setq end (point))
|
||||||
(or (and (not name)
|
(or (and
|
||||||
(progn ;; unnamed results line already exists
|
(not name)
|
||||||
(re-search-forward "[^ \f\t\n\r\v]" nil t)
|
(progn ;; unnamed results line already exists
|
||||||
|
(catch 'non-comment
|
||||||
|
(while (re-search-forward "[^ \f\t\n\r\v]" nil t)
|
||||||
(beginning-of-line 1)
|
(beginning-of-line 1)
|
||||||
(looking-at
|
(cond
|
||||||
(concat org-babel-result-regexp "\n")))
|
((looking-at (concat org-babel-result-regexp "\n"))
|
||||||
(let ((this-hash (match-string 5)))
|
(throw 'non-comment t))
|
||||||
(prog1 (point)
|
((looking-at "^[ \t]*#") (end-of-line 1))
|
||||||
;; must remove and rebuild if hash!=old-hash
|
(t (throw 'non-comment nil))))))
|
||||||
(if (and hash (not (string= hash this-hash)))
|
(let ((this-hash (match-string 5)))
|
||||||
(prog1 nil
|
(prog1 (point)
|
||||||
(forward-line 1)
|
;; must remove and rebuild if hash!=old-hash
|
||||||
(delete-region
|
(if (and hash (not (string= hash this-hash)))
|
||||||
end (org-babel-result-end)))
|
(prog1 nil
|
||||||
(setq end nil)))))))))))
|
(forward-line 1)
|
||||||
|
(delete-region
|
||||||
|
end (org-babel-result-end)))
|
||||||
|
(setq end nil)))))))))))
|
||||||
(if (not (and insert end)) found
|
(if (not (and insert end)) found
|
||||||
(goto-char end)
|
(goto-char end)
|
||||||
(unless beg
|
(unless beg
|
||||||
|
|
Loading…
Reference in a new issue