1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-21 06:55:35 +00:00

org-babel-exp-process-buffer: Fix edge case when src block ends at eob

* lisp/ob-exp.el (org-babel-exp-process-buffer): When src block ends
at eob, do not leave the #+end_src behind after replacement.
This commit is contained in:
Ihor Radchenko 2024-06-13 17:26:02 +02:00
parent e4902995a0
commit a13d8fe83b
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -265,8 +265,9 @@ this template."
(if (not (eq type 'babel-call))
(progn (skip-chars-forward " \t")
(point))
(skip-chars-forward " \r\t\n")
(line-beginning-position)))))
(unless (eobp)
(skip-chars-forward " \r\t\n")
(line-beginning-position))))))
((not rep)
;; Replacement code cannot be determined.
;; Leave the code block as is.
@ -291,8 +292,9 @@ this template."
(cond ((not replacement) (goto-char end))
((equal replacement "")
(goto-char end)
(skip-chars-forward " \r\t\n")
(forward-line 0)
(unless (eobp)
(skip-chars-forward " \r\t\n")
(forward-line 0))
(delete-region begin (point)))
(t
(if (org-src-preserve-indentation-p element)