emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org 0f1184a850: Merge branch 'bugfix'


From: ELPA Syncer
Subject: [elpa] externals/org 0f1184a850: Merge branch 'bugfix'
Date: Sun, 25 Dec 2022 07:57:59 -0500 (EST)

branch: externals/org
commit 0f1184a850737d22bf78ee6d7621f65fd2679d4f
Merge: 46dbd59f03 718e196830
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>

    Merge branch 'bugfix'
---
 lisp/org-element.el      | 16 +++++++++++--
 lisp/org.el              |  5 +++-
 testing/lisp/test-org.el | 62 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/lisp/org-element.el b/lisp/org-element.el
index e3f0c82997..9e0e4f0237 100644
--- a/lisp/org-element.el
+++ b/lisp/org-element.el
@@ -1365,7 +1365,16 @@ Assume point is at beginning of the inline task."
           (priority (and (looking-at "\\[#.\\][ \t]*")
                          (progn (goto-char (match-end 0))
                                 (aref (match-string 0) 2))))
-          (title-start (point))
+           (commentedp
+           (and (let ((case-fold-search nil))
+                   (looking-at org-element-comment-string))
+                (goto-char (match-end 0))
+                 (when (looking-at-p "\\(?:[ \t]\\|$\\)")
+                   (point))))
+          (title-start (prog1 (point)
+                          (unless (or todo priority commentedp)
+                            ;; Headline like "* :tag:"
+                            (skip-chars-backward " \t"))))
           (tags (when (re-search-forward
                        "[ \t]+\\(:[[:alnum:]_@#%:]+:\\)[ \t]*$"
                        (line-end-position)
@@ -1375,6 +1384,7 @@ Assume point is at beginning of the inline task."
           (title-end (point))
           (raw-value (org-trim
                       (buffer-substring-no-properties title-start title-end)))
+           (archivedp (member org-element-archive-tag tags))
           (task-end (save-excursion
                       (end-of-line)
                       (and (re-search-forward org-element-headline-re limit t)
@@ -1410,7 +1420,9 @@ Assume point is at beginning of the inline task."
                         :todo-keyword todo
                         :todo-type todo-type
                         :post-blank (1- (count-lines (or task-end begin) end))
-                        :post-affiliated begin)
+                        :post-affiliated begin
+                         :archivedp archivedp
+                        :commentedp commentedp)
                   time-props
                   standard-props))))
       (org-element-put-property
diff --git a/lisp/org.el b/lisp/org.el
index 8dad3fafe5..26a4c8b1c6 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20179,7 +20179,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 0eed372d4f..cd7011de12 100644
--- a/testing/lisp/test-org.el
+++ b/testing/lisp/test-org.el
@@ -175,6 +175,26 @@
          (org-test-with-temp-text "* Test"
            (call-interactively #'org-comment-dwim)
            (buffer-string))))
+  ;; Uncomment a heading
+  (should
+   (equal "* Test"
+         (org-test-with-temp-text "* COMMENT Test"
+           (call-interactively #'org-comment-dwim)
+           (buffer-string))))
+  ;; Comment an inlinetask
+  (should
+   (equal "*** COMMENT Test"
+          (let ((org-inlinetask-min-level 3))
+           (org-test-with-temp-text "*** Test"
+             (call-interactively #'org-comment-dwim)
+             (buffer-string)))))
+  ;; Uncomment an inlinetask
+  (should
+   (equal "*** Test"
+         (let ((org-inlinetask-min-level 3))
+           (org-test-with-temp-text "*** COMMENT Test"
+             (call-interactively #'org-comment-dwim)
+             (buffer-string)))))
   ;; In a source block, use appropriate syntax.
   (should
    (equal "  ;; "
@@ -2261,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.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]