[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals-release/org 718e196830 2/2: org-back-to-heading: Fix at
From: |
ELPA Syncer |
Subject: |
[elpa] externals-release/org 718e196830 2/2: org-back-to-heading: Fix at inlinetask END |
Date: |
Sun, 25 Dec 2022 07:57:58 -0500 (EST) |
branch: externals-release/org
commit 718e1968305a3c978d14f69cb8fa3af8fa643cf1
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
org-back-to-heading: Fix at inlinetask END
* lisp/org.el (org-back-to-heading): Fix when at inlinetask END.
* testing/lisp/test-org.el (test-org/org-back-to-heading): Add new
test.
Reported-by: Alain.Cochard@unistra.fr
Link: https://orgmode.org/list/25508.20192.899342.932809@gargle.gargle.HOWL
---
lisp/org.el | 5 ++++-
testing/lisp/test-org.el | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 46 insertions(+), 1 deletion(-)
diff --git a/lisp/org.el b/lisp/org.el
index 6aa2a16219..ab8b76b926 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20213,7 +20213,10 @@ interactive command with similar behavior."
(defun org-back-to-heading (&optional invisible-ok)
"Go back to beginning of heading."
(beginning-of-line)
- (or (org-at-heading-p (not invisible-ok))
+ (or (and (org-at-heading-p (not invisible-ok))
+ (not (and (featurep 'org-inlinetask)
+ (fboundp 'org-inlinetask-end-p)
+ (org-inlinetask-end-p))))
(if (org-element--cache-active-p)
(let ((heading (org-element-lineage (org-element-at-point)
'(headline inlinetask)
diff --git a/testing/lisp/test-org.el b/testing/lisp/test-org.el
index 47cb8d8813..f999189aad 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -2281,6 +2281,48 @@ CLOCK: [2022-09-17 sam. 11:00]--[2022-09-17 sam. 11:46]
=> 0:46"
;;; Headline
+(ert-deftest test-org/org-back-to-heading ()
+ "Test `org-back-to-heading' specifications."
+ ;; On heading already
+ (org-test-with-temp-text "* Head<point>ing"
+ (org-back-to-heading)
+ (should (bobp)))
+ ;; Below heading
+ (org-test-with-temp-text "* Heading
+Text<point>"
+ (org-back-to-heading)
+ (should (bobp)))
+ ;; At inlinetask
+ (let ((org-inlinetask-min-level 3))
+ (org-test-with-temp-text "* Heading
+*** Inlinetask <point>"
+ (org-back-to-heading)
+ (should (= 11 (point)))))
+ ;; Below inlinetask
+ (let ((org-inlinetask-min-level 3))
+ (org-test-with-temp-text "* Heading
+*** Inlinetask
+Test <point>"
+ (org-back-to-heading)
+ ;; Not at or inside inlinetask. Move to parent heading.
+ (should (bobp))))
+ ;; Inside inlinetask
+ (let ((org-inlinetask-min-level 3))
+ (org-test-with-temp-text "* Heading
+*** Inlinetask
+Test <point>
+*** END"
+ (org-back-to-heading)
+ (should (= 11 (point)))))
+ ;; At END
+ (let ((org-inlinetask-min-level 3))
+ (org-test-with-temp-text "* Heading
+*** Inlinetask
+Test
+*** END<point>"
+ (org-back-to-heading)
+ (should (= 11 (point))))))
+
(ert-deftest test-org/get-heading ()
"Test `org-get-heading' specifications."
;; Return current heading, even if point is not on it.