org-babel: Fix insertion of new results

Insertion of new results was failing if the block was followed by
end-of-buffer. Also, if the block was followed by non-empty lines, the
\#+resname was being inserted away from column 0.
This commit is contained in:
Dan Davison 2009-11-27 14:03:25 -05:00 committed by Eric Schulte
parent 0f85963ae2
commit 4cbedbff1a
1 changed files with 2 additions and 1 deletions

View File

@ -639,7 +639,8 @@ following the source block."
(looking-at (concat org-babel-result-regexp "\n"))))
;; or (with optional insert) back up and make one ourselves
(when insert
(goto-char end) (forward-char 1)
(goto-char end)
(if (looking-at "[\n\r]") (forward-char 1) (insert "\n"))
(insert (concat "#+results" (if hash (concat "["hash"]"))
":"(if name (concat " " name)) "\n"))
(move-beginning-of-line 0)