org-mode 时钟 table 按标签

org-mode clock table by tag

在 Emacs org-mode 中,是否可以让时钟报告 table 显示在每个标签上花费了多少时间? manual 似乎是这么认为的,但我做不到。这是我试过的:

#+BEGIN: clocktable :maxlevel 2 :scope file :tags nicetag

#+END:

* Header one :nicetag:
:LOGBOOK:  
CLOCK: [2016-07-23 Sat 18:24]--[2016-07-23 Sat 19:38] =>  1:14
CLOCK: [2016-07-23 Sat 12:23]--[2016-07-23 Sat 13:43] =>  1:20
:END:      
* Another header :bigtag:
:LOGBOOK:  
CLOCK: [2016-07-23 Sat 20:24]--[2016-07-23 Sat 20:34] =>  0:10
:END:
* A task  :nicetag:
:LOGBOOK:  
CLOCK: [2016-07-23 Sat 10:26]--[2016-07-23 Sat 11:26] =>  1:00
:END:      

我想要 table 显示所有带有标签 :nicetag: 的 headers 所花费的时间,但 table 不显示任何内容。更好的方法是让 table 显示在文件中的每个标签上花费的时间。

你是说吗?

#+BEGIN: clocktable :maxlevel 2 :scope file :tags "nicetag"

(请注意您的标签周围的“”。)当您尝试在没有“”的情况下使用它时,回显区域中显示的错误消息是 "Wrong type argument: stringp, nicetag",这意味着 Emacs 期望读取一个字符串但得到了不是的东西。希望对您有所帮助!

我相信 :tags 在 2016 年和现在 (2020) 之间发生了变化,所以这里是 "update":

在文档中 (https://orgmode.org/manual/The-clock-table.html#The-clock-table) 我看到 :tags 的解释是这样的

‘:tags’

    When this flag is non-nil, show the headline’s tags.

所以 :tags 应该只启用一列标签。我尝试了 :tags "mytag" 并发现它没有按照 OP 的要求进行过滤。而是 :match "mytag" 执行此过滤。

‘:match’

    A tags match to select entries that should contribute. See Matching tags and properties for the match syntax.

然后来自 OP:

#+BEGIN: clocktable :maxlevel 2 :scope file :tags t :match "nicetag"
#+CAPTION: Clock summary at [2020-01-23 Thu 09:51]
| Tags    | Headline     |   Time |
|---------+--------------+--------|
|         | *Total time* | *3:34* |
|---------+--------------+--------|
| nicetag | Header one   |   2:34 |
| nicetag | A task       |   1:00 |
#+END:

* Header one :nicetag:
:LOGBOOK:  
CLOCK: [2016-07-23 Sat 18:24]--[2016-07-23 Sat 19:38] =>  1:14
CLOCK: [2016-07-23 Sat 12:23]--[2016-07-23 Sat 13:43] =>  1:20
:END:      
* Another header :bigtag:
:LOGBOOK:  
CLOCK: [2016-07-23 Sat 20:24]--[2016-07-23 Sat 20:34] =>  0:10
:END:
* A task  :nicetag:
:LOGBOOK:  
CLOCK: [2016-07-23 Sat 10:26]--[2016-07-23 Sat 11:26] =>  1:00
:END:

没有 :tags t 我们得到的结果与没有标签列的结果相同

#+BEGIN: clocktable :maxlevel 2 :scope file :match "nicetag"
#+CAPTION: Clock summary at [2020-01-23 Thu 09:53]
| Headline     |   Time |
|--------------+--------|
| *Total time* | *3:34* |
|--------------+--------|
| Header one   |   2:34 |
| A task       |   1:00 |
#+END: