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

org-comment-or-uncomment-region: Fix comment boundaries inside src blocks

* lisp/org.el (org-comment-or-uncomment-region): When calculating
region boundaries inside src edit buffer, do not assume that region
length does not change - it may, when the indentation inside src edit
buffer is different from the Org buffer.

Reported-by: Stephanus Comnenus <linjt267@gmail.com>
Link: https://orgmode.org/list/CAHqtn=fWq6E5_pm72AB9vFxwjS0a8ma=UvVjMrgeivE9pa13ZQ@mail.gmail.com

TINYCHANGE
This commit is contained in:
Ihor Radchenko 2024-10-12 10:47:11 +02:00
parent b457dbfe5a
commit 19d462e7a7
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -20557,11 +20557,15 @@ strictly within a source block, use appropriate comment syntax."
end)))
;; Translate region boundaries for the Org buffer to the source
;; buffer.
(let ((offset (- end beg)))
(let (src-end)
(save-excursion
(goto-char end)
(org-babel-do-in-edit-buffer
(setq src-end (point))))
(save-excursion
(goto-char beg)
(org-babel-do-in-edit-buffer
(comment-or-uncomment-region (point) (+ offset (point))))))
(comment-or-uncomment-region (point) src-end))))
(save-restriction
;; Restrict region
(narrow-to-region (save-excursion (goto-char beg)