branch: externals/org
commit 629d08fa55c9515d93c01018a642c67d1d095fe0
Author: Morgan Smith <[email protected]>
Commit: Ihor Radchenko <[email protected]>
Clocktables: Indent inline tasks under their heading
Previously an inline task under a heading would appear in the
clocktable as:
| Headline | Time |
|--------------+--------|
| *Total time* | *1:00* |
|--------------+--------|
| Parent | 1:00 |
| Inline | 1:00 |
But now it appears as:
| Headline | Time | |
|--------------+--------+------|
| *Total time* | *1:00* | |
|--------------+--------+------|
| Parent | 1:00 | |
| \\_ Inline | | 1:00 |
This is more intuitive as it treats inline tasks the same way
subheadings are treated.
* etc/ORG-NEWS: Add news entry.
* lisp/org-clock.el (lisp/org-clock.el): Increase the level of inline
tasks by 1.
* testing/lisp/test-org-clock.el
(test-org-clock/clocktable/inlinetask/insert)
(test-org-clock/clocktable/inlinetask/open-clock): Adjust tests to new
behavior.
---
etc/ORG-NEWS | 10 ++++++++++
lisp/org-clock.el | 11 ++++++-----
testing/lisp/test-org-clock.el | 25 +++++++++++++------------
3 files changed, 29 insertions(+), 17 deletions(-)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 87fbf8f065..0365a99b9b 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -114,6 +114,16 @@ To use the old behavior and export active timestamps only
without
diary timestamps, users can set ~org-export-with-timestamps~ and
~org-icalendar-with-timestamps~ to ~active-exclude-diary~.
+*** Inline tasks in a clocktable will be indented to a level below their
heading
+
+Previously a clocktable that contained an inline task would show the
+task at the same indentation level as the heading that contains it.
+Now the inline task is indented to be one lower then its parent
+heading.
+
+This also fixes a bug where creating a clocktable that includes an
+inline task before any headings would cause an error.
+
*** =ob-calc.el=: Vector and matrix are now inserted as Org tables by default
~ob-calc~ now formats vector and matrix results as Org tables. This
diff --git a/lisp/org-clock.el b/lisp/org-clock.el
index dada29457c..079f0491fd 100644
--- a/lisp/org-clock.el
+++ b/lisp/org-clock.el
@@ -3210,11 +3210,12 @@ PROPERTIES: The list properties specified in the
`:properties' parameter
(if (eq 'headline (org-element-type elm))
(org-element-property :level elm)
;; inline task
- (or (org-element-lineage-map elm
- (lambda (elm)
- (org-element-property :level elm))
- '(headline) nil t)
- 1)))
+ (1+
+ (or (org-element-lineage-map elm
+ (lambda (elm)
+ (org-element-property :level elm))
+ '(headline) nil t)
+ 0))))
(level (when (<= level maxlevel) level))
(title
(let ((headline (org-element-property :title elm)))
diff --git a/testing/lisp/test-org-clock.el b/testing/lisp/test-org-clock.el
index 9992f1da6c..9ab8a1b67c 100644
--- a/testing/lisp/test-org-clock.el
+++ b/testing/lisp/test-org-clock.el
@@ -1668,12 +1668,12 @@ Variables'."
"Test insert clocktable on an inline task."
(should
(equal
- "| Headline | Time |
-|--------------+--------|
-| *Total time* | *2:00* |
-|--------------+--------|
-| H1 | 2:00 |
-| I | 2:00 |"
+ "| Headline | Time | |
+|--------------+--------+------|
+| *Total time* | *2:00* | |
+|--------------+--------+------|
+| H1 | 2:00 | |
+| \\_ I | | 2:00 |"
(let ((org-inlinetask-min-level 5))
(org-test-with-temp-text "* H1
***** I
@@ -1706,12 +1706,13 @@ foo"
"Test open clocks on an inline task.
Open clocks should be ignored unless it is clocked in and
`org-clock-report-include-clocking-task' is t."
- (let ((time-reported "| Headline | Time |
-|--------------+--------|
-| *Total time* | *1:00* |
-|--------------+--------|
-| H1 | 1:00 |
-| I | 1:00 |")
+ (let ((time-reported
+ "| Headline | Time | |
+|--------------+--------+------|
+| *Total time* | *1:00* | |
+|--------------+--------+------|
+| H1 | 1:00 | |
+| \\_ I | | 1:00 |")
(time-not-reported "| Headline | Time |
|--------------+--------|
| *Total time* | *0:00* |")