From 2ca59eaa0fe31400780c092c3e566cad10f4a425 Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Fri, 29 May 2009 23:34:50 -0400 Subject: [PATCH] Preventing end of buffer error when no newline after #+end_src --- lisp/org-babel.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/org-babel.el b/lisp/org-babel.el index df66c3e31..7b3a731ed 100644 --- a/lisp/org-babel.el +++ b/lisp/org-babel.el @@ -233,7 +233,9 @@ line. If no result exists for this block then create a (let ((name (org-babel-get-src-block-name)) end head) (or (and name (message name) (org-babel-find-named-result name)) (and (re-search-forward "#\\+end_src" nil t) - (progn (move-end-of-line 1) (forward-char 1) (setq end (point)) + (progn (move-end-of-line 1) + (if (eobp) (insert "\n") (forward-char 1)) + (setq end (point)) (or (progn ;; either an unnamed #+resname: line already exists (re-search-forward "[^ \f\t\n\r\v]" nil t) (move-beginning-of-line 1) (looking-at "#\\+resname:"))