[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals-release/org a13d8fe83b 1/3: org-babel-exp-process-buffe
From: |
ELPA Syncer |
Subject: |
[elpa] externals-release/org a13d8fe83b 1/3: org-babel-exp-process-buffer: Fix edge case when src block ends at eob |
Date: |
Thu, 13 Jun 2024 12:58:49 -0400 (EDT) |
branch: externals-release/org
commit a13d8fe83b5d49a97ec3c60d5312549db1be9055
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
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.
---
lisp/ob-exp.el | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el
index 657cb2b526..5516530c5b 100644
--- a/lisp/ob-exp.el
+++ b/lisp/ob-exp.el
@@ -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)