Preventing end of buffer error when no newline after #+end_src

This commit is contained in:
Dan Davison 2009-05-29 23:34:50 -04:00
parent f87a673c9c
commit 2ca59eaa0f
1 changed files with 3 additions and 1 deletions

View File

@ -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:"))