[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 069bcba: org: Fix functionality of org-insert-headi
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 069bcba: org: Fix functionality of org-insert-heading |
Date: |
Sat, 18 Sep 2021 08:57:14 -0400 (EDT) |
branch: externals/org
commit 069bcba529142bdb91647258924513f0fb0f3fa1
Author: Marco Wahl <marcowahlsoft@gmail.com>
Commit: Marco Wahl <marcowahlsoft@gmail.com>
org: Fix functionality of org-insert-heading
* lisp/org.el (org-insert-heading): Fix insertion of headings when
point is before any heading in the case of "respect content" insertion.
Kudos to Victor Stoichita.
https://orgmode.org/list/87lf4594t3.fsf@svictor.net/
---
lisp/org.el | 4 +++-
testing/lisp/test-org.el | 15 +++++++++++++++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/lisp/org.el b/lisp/org.el
index 8b9d571..733dda4 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -7039,7 +7039,9 @@ unconditionally."
(org-before-first-heading-p)))
(insert "\n")
(backward-char))
- (unless level (backward-char))
+ (when (and (not level) (not (eobp)) (not (bobp)))
+ (when (org-at-heading-p) (insert "\n"))
+ (backward-char))
(unless (and blank? (org-previous-line-empty-p))
(org-N-empty-lines-before-current (if blank? 1 0)))
(insert stars " ")
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index de3c6f3..f3a729b 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -1604,6 +1604,21 @@
;; point.
(should
(equal
+ "* "
+ (org-test-with-temp-text ""
+ (let ((org-insert-heading-respect-content nil))
+ (org-insert-heading '(4)))
+ (buffer-string))))
+ (should
+ (equal
+ "entry
+* "
+ (org-test-with-temp-text "entry"
+ (let ((org-insert-heading-respect-content nil))
+ (org-insert-heading '(4)))
+ (buffer-string))))
+ (should
+ (equal
"* H1\n** H2\n* "
(org-test-with-temp-text "* H1\n** H2"
(let ((org-insert-heading-respect-content nil))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org 069bcba: org: Fix functionality of org-insert-heading,
ELPA Syncer <=