在时钟表报告中包含日期或时间

Including date or time in clocktable report

我不认为这会很困难,但我无法挖掘任何关于如何使组织模式时钟 table 报告包含任务的 date/time 的信息。我的报告是这样的:

#+BEGIN: clocktable :scope agenda-with-archives  :timestamp "TIMESTAMP" :link nil :maxlevel 3  :tstart "<-1w>" :tend "<now>" :stepskip0 t :fileskip0 t :tcolumns 3 :narrow 110 :hidefiles t 
#+CAPTION: Clock summary at [2021-01-20 Wed 10:47]
   |                 |                             | <110>                                                                      |         |      |
   | File            | Timestamp                   | Headline                                                                   | Time    |      |
   |-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
   |                 | ALL                         | -Total time-                                                               | -12:36- |      |
   |-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
   | inbox.org       |                             | -- File time                                                               | *1:12*  |      |
   |                 |                             | Inbox                                                                      | 1:12    |      |
   |                 |                             | \_  Chat w/Saranya                                                         |         | 0:01 |
   |                 | [2021-01-20 Wed 10:45]      | \_  Troubleshoot Cylance/3503 issue                                        |         | 1:11 |
   |-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
   | 01-14.org       |                             | -- File time                                                               | *1:11*  |      |
   |                 |                             | \_  MEETING: Build discussion/working session                              |         | 1:11 |
   |-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
   | 01-18.org       |                             | -- File time                                                               | *1:25*  |      |
   |                 |                             | \_  MEETING: MBean registration failures in MAG DEV2 (and MAG QA2)         |         | 1:25 |
   |-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
   | 01-19.org       |                             | -- File time                                                               | *1:55*  |      |
   |                 |                             | \_  MEETING: nTier Bi-Weekly - Check point                                 |         | 1:00 |
   |                 |                             | \_  MEETING: MBE Project Status Update Meeting  - Investment and MRO       |         | 0:39 |
   |                 |                             | \_  MEETING: Discuss problems encountered when installing package for 3503 |         | 0:16 |
   |-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
   | admin.org       |                             | -- File time                                                               | *0:12*  |      |
   |                 |                             | Admin                                                                      | 0:12    |      |
   |                 | <2021-01-14 Thu 09:00 ++1w> | \_  Manage timesheet                                                       |         | 0:07 |
   |                 | <2021-01-13 Wed 09:00 ++1w> | \_  Create Deploy & Environments Meeting Agenda                            |         | 0:05 |
   |-----------------+-----------------------------+----------------------------------------------------------------------------+---------+------|
...

我想要的是没有文件列,然后为每个任务设置某种类型的时间戳。我尝试了各种 special properties,但我似乎找不到任何始终给我时间戳的东西。

如果我在 属性 抽屉外有一个日志条目,它有一个重复的时间表或一个不活动的时间戳,那么它就可以挑选一些东西。例如,在上面的 table 中,基础任务有这样的条目:

** WIP Troubleshoot Cylance/3503 issue                                  :MBE:
   :PROPERTIES:
   :CREATED:  <2021-01-20 Wed 10:46>
   :END:
   :LOGBOOK:
   CLOCK: [2021-01-20 Wed 09:35]--[2021-01-20 Wed 10:46] =>  1:11
   :END:
   [2021-01-20 Wed 10:45] - <snip log entry>.
...
** WIP [#B] Create Deploy & Environments Meeting Agenda
   SCHEDULED: <2021-01-13 Wed 09:00 ++1w>
   :PROPERTIES:
   :LAST_REPEAT: [2021-01-06 Wed 09:35]
   :EFFORT:   0:15
   :END:
   :LOGBOOK:
   CLOCK: [2021-01-20 Wed 08:42]--[2021-01-20 Wed 08:47] =>  0:05
   <snip>
   CLOCK: [2020-07-14 Tue 16:17]--[2020-07-14 Tue 16:39] =>  0:22
   :END:

问题是我的大部分任务都是未安排的 and/or 在日志之外没有时间戳。我已经为 :timestamp 参数尝试了各种值,但它似乎并不重要。

任何人都可以建议如何创建一个时钟 table 在一列中包含任务时间吗?

我遇到的另一个问题是即使使用 :hidefiles 它也总是显示 File 列。

我对在 org-mode 中使用 clock tables 还是很陌生,但是前几天我在搜索与 org-mode 相关的东西时遇到了你的问题。

可能有助于显示时间戳的东西与使用名为 :properties("CLOSED") 的设置有关。我从 a post by @Fabian 上读到过这个。使用此设置时,它会添加一个名为“CLOSED”的列,该列应显示任务“CLOSED”时的日期时间戳。

但是,在此之前,您可能需要先将以下设置添加到 .emacs 设置文件中:(setq org-log-done 'time)。我在 the org-mode documentation 中读到过这个。设置此设置后,如果您在 org-mode 中使用“TODO”功能:一旦您将任务设置为“DONE”,则应将“CLOSED”日期时间戳添加到您的任务中。从那里开始,一旦您刷新时钟 table,这个新的日期时间戳就会出现在“已关闭”列中。

此外,在玩 :hidefiles settings 之后,我 运行 遇到了同样的问题,即使 [=15],“文件”列仍然出现=] 设置集。我之前尝试解决此问题(在较早的答案修订版中)似乎实际上并没有按照我的想法进行,因此我暂时删除了该部分。我感觉这个 :hidefiles 设置问题可能与正在使用的 org-mode 版本有关。

更新: 在尝试更新版本的 org-mode (20210201) 后,:hidefiles 设置似乎按预期工作。我使用 this documentation page 中的设置说明以及以下步骤安装了新的 org-mode 版本。

警告:您可能希望根据需要使用旧版本的 org-mode。就我自己而言,我尝试了一个非常新的 org-mode 版本(在撰写本文时),但对于您的目的来说它可能太新了。如果您选择这样做,请在执行以下步骤之前考虑是否需要尝试旧版本。

  1. 将这些行添加到 .emacs 文件:

    (require 'package)
    (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t)

  2. 打开一个空白的 emacs 编辑器

  3. 类型:M-x list-packages

  4. 导航到 org 选项(我选择了 20210201 选项,但这可能会有所不同)以便光标位于 org link

  5. return/enter

  6. 类型:C-x o

  7. 导航到 Install 选项,使光标位于 Install link

  8. return/enter

  9. 如果你想安装这个

    y继续
  10. 包应该在此时安装

  11. 完成后,退出 emacs

  12. 然后,打开您的 .org 文件

此外:我将以下设置添加到我的 .emacs 文件中,因为我通常喜欢在 .org 文件首次以 org-mode 打开时隐藏各种列表:

; ref: https://orgmode.org/guide/Visibility-Cycling.html
(setq org-startup-folded t)

这是我在 example.org 文件中使用的设置的更新示例(部分基于您的原始示例):

#+BEGIN: clocktable :scope agenda-with-archives :properties("CLOSED") :maxlevel 3  :tstart "<-2w>" :tend "<now>" :timestamp t :hidefiles t
#+CAPTION: Clock summary at [2021-02-01 Mon 16:30]
| Timestamp                   | CLOSED                 | Headline                                     | Time   |      |
|-----------------------------+------------------------+----------------------------------------------+--------+------|
|                             |                        | *Total time*                                 | *1:17* |      |
|-----------------------------+------------------------+----------------------------------------------+--------+------|
|                             |                        | topic                                        | 1:17   |      |
|                             | [2021-01-29 Fri 18:22] | \_  test                                     |        | 0:01 |
| [2021-01-20 Wed 10:45]      | [2021-01-29 Fri 18:26] | \_  WIP Troubleshoot Cylance/3503 issue      |        | 1:11 |
| <2021-02-26 Fri 09:00 ++1w> |                        | \_  WIP [#B] Create Deploy & Environments... |        | 0:05 |
|-----------------------------+------------------------+----------------------------------------------+--------+------|
|-----------------------------+------------------------+----------------------------------------------+--------+------|
#+END:

* topic
** DONE test
   CLOSED: [2021-01-29 Fri 18:22]
   CLOCK: [2021-01-29 Fri 18:21]--[2021-01-29 Fri 18:22] =>  0:00
** DONE WIP Troubleshoot Cylance/3503 issue       :MBE:
   CLOSED: [2021-01-29 Fri 18:26]
   :PROPERTIES:
   :CREATED:  <2021-01-20 Wed 10:46>
   :END:
   :LOGBOOK:
   CLOCK: [2021-01-20 Wed 09:35]--[2021-01-20 Wed 10:46] =>  1:11
   :END:
   [2021-01-20 Wed 10:45] - <snip log entry>.
** TODO WIP [#B] Create Deploy & Environments Meeting Agenda
   SCHEDULED: <2021-02-26 Fri 09:00 ++1w>
   - State "DONE"       from "TODO"       [2021-01-30 Sat 10:56]
   :PROPERTIES:
   :LAST_REPEAT: [2021-01-30 Sat 10:56]
   :EFFORT:   0:15
   :END:
   :LOGBOOK:
   CLOCK: [2021-01-20 Wed 08:42]--[2021-01-20 Wed 08:47] =>  0:05
   <snip>
   CLOCK: [2020-07-14 Tue 16:17]--[2020-07-14 Tue 16:39] =>  0:22
   :END:

如果要添加新的“CLOSED”列,是否要删除 :timestamp t 设置由您决定。

不过,“已关闭”列的缺点是我还没有找到一种方法可以让计划任务(已定期完成)在“关闭”列。 “时间戳”列中似乎显示了“SCHEDULED”设置,但这可能不是您想要的。

希望这些信息对您有所帮助!