mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 20:07:46 +00:00
org-clock: Fix missing properties in Clock table
* lisp/org-clock.el (org-clocktable-write-default): Do not ignore
properties specified by :properties parameter.
* testing/lisp/test-org-clock.el (test-org-clock/clocktable/properties):
New test.
The regression was introduced in b897ab722
.
Reported-by: Dale <dale@codefu.org>
<http://permalink.gmane.org/gmane.emacs.orgmode/112219>
This commit is contained in:
parent
21797c3185
commit
a6c318f471
|
@ -2587,7 +2587,7 @@ from the dynamic block definition."
|
|||
|
||||
;; Get the list of node entries and iterate over it
|
||||
(when (> maxlevel 0)
|
||||
(pcase-dolist (`(,level ,headline ,ts ,time . ,props) entries)
|
||||
(pcase-dolist (`(,level ,headline ,ts ,time ,props) entries)
|
||||
(when narrow-cut-p
|
||||
(setq headline
|
||||
(if (and (string-match
|
||||
|
@ -2599,12 +2599,11 @@ from the dynamic block definition."
|
|||
(org-shorten-string (match-string 3 headline)
|
||||
narrow))
|
||||
(org-shorten-string headline narrow))))
|
||||
(cl-flet ((format-field
|
||||
(let ((marker (pcase level
|
||||
((guard (not emph)) "")
|
||||
(1 "*") (2 "/") (_ ""))))
|
||||
(lambda (field)
|
||||
(format "%s%s%s |" marker field marker)))))
|
||||
(cl-flet ((format-field (f) (format (cond ((not emph) "%s |")
|
||||
((= level 1) "*%s* |")
|
||||
((= level 2) "/%s/ |")
|
||||
(t "%s |"))
|
||||
f)))
|
||||
(insert-before-markers
|
||||
"|" ;start the table line
|
||||
(if multifile "|" "") ;free space for file name column?
|
||||
|
|
|
@ -695,6 +695,61 @@ CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00
|
|||
(buffer-substring-no-properties (line-beginning-position 3)
|
||||
(line-beginning-position 9))))))
|
||||
|
||||
(ert-deftest test-org-clock/clocktable/properties ()
|
||||
"Test \":properties\" parameter in Clock table."
|
||||
;; Include a new column with list properties.
|
||||
(should
|
||||
(equal
|
||||
"| A | Headline | Time | |
|
||||
|---+--------------+---------+---|
|
||||
| | *Total time* | *26:00* | |
|
||||
|---+--------------+---------+---|
|
||||
| 1 | Foo | 26:00 | |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
:PROPERTIES:
|
||||
:A: 1
|
||||
:END:
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00
|
||||
"
|
||||
(test-org-clock-clocktable-contents-at-point ":properties (\"A\")"))))
|
||||
(should
|
||||
(equal
|
||||
"| A | Headline | Time | |
|
||||
|---+--------------+---------+-------|
|
||||
| | *Total time* | *52:00* | |
|
||||
|---+--------------+---------+-------|
|
||||
| | Foo | 52:00 | |
|
||||
| 1 | \\_ Bar | | 26:00 |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00
|
||||
** Bar
|
||||
:PROPERTIES:
|
||||
:A: 1
|
||||
:END:
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00
|
||||
"
|
||||
(test-org-clock-clocktable-contents-at-point ":properties (\"A\")"))))
|
||||
;; Handle missing properties.
|
||||
(should
|
||||
(equal
|
||||
"| A | Headline | Time | |
|
||||
|---+--------------+---------+---|
|
||||
| | *Total time* | *26:00* | |
|
||||
|---+--------------+---------+---|
|
||||
| 1 | Foo | 26:00 | |
|
||||
"
|
||||
(org-test-with-temp-text
|
||||
"* Foo
|
||||
:PROPERTIES:
|
||||
:A: 1
|
||||
:END:
|
||||
CLOCK: [2016-12-27 Wed 13:09]--[2016-12-28 Wed 15:09] => 26:00
|
||||
"
|
||||
(test-org-clock-clocktable-contents-at-point ":properties (\"A\")")))))
|
||||
|
||||
(provide 'test-org-clock)
|
||||
;;; test-org-clock.el end here
|
||||
|
|
Loading…
Reference in a new issue