From 4cbedbff1adf22e2018baf5c674b32a91c68007e Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Fri, 27 Nov 2009 14:03:25 -0500 Subject: [PATCH] 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. --- contrib/babel/lisp/org-babel.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contrib/babel/lisp/org-babel.el b/contrib/babel/lisp/org-babel.el index 0b68be31e..4c9bff5ab 100644 --- a/contrib/babel/lisp/org-babel.el +++ b/contrib/babel/lisp/org-babel.el @@ -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)