summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIhor Radchenko <yantar92@posteo.net>2023-12-17 14:54:43 +0100
committerIhor Radchenko <yantar92@posteo.net>2023-12-17 14:57:11 +0100
commit67ce9386ad1d050cb1ba75436619184197d58dd9 (patch)
treec17f11a8850bf494c8044cb279940eebe1384016
parentbf1d45f9bad194fb9a45eb1d6573fe15622f8315 (diff)
downloadorg-mode-67ce9386a.tar.gz
lisp/org.el (org-sort-entries): Fix when end of region is not a bol
* lisp/org.el (org-sort-entries): Avoid putting a heading not at bol when end of selected region is not at bol. Reported-by: Zelphir Kaltstahl <zelphirkaltstahl@posteo.de> Link: https://orgmode.org/list/8d637a8a-6cbc-4158-bded-f9182716a1fc@posteo.de
-rw-r--r--lisp/org.el6
1 files changed, 6 insertions, 0 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 6957219..f3679dd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7778,6 +7778,12 @@ function is being called interactively."
(save-restriction
(narrow-to-region start end)
+ ;; No trailing newline - add one to avoid
+ ;; * heading
+ ;; text* another heading
+ (save-excursion
+ (goto-char end)
+ (unless (bolp) (insert "\n")))
(let ((restore-clock?
;; The clock marker is lost when using `sort-subr'; mark
;; the clock with temporary `:org-clock-marker-backup'