将注释列添加到 emacs org-mode 时钟表

jka*_*zan 3 emacs org-mode

我真的希望能够通过对每个项目的评论来记录工作,例如:

#+BEGIN: clocktable :maxlevel 3 :emphasize nil :scope file :block thisweek :properties ("COMMENT")
#+CAPTION: Clock summary at [2018-12-06 Thu 15:16], for week 2018-W49.
| Headline                         | Time   |      |  COMMENT  |
+----------------------------------+--------+------|-----------|
| *Total time*                     | *0:15* |      |           |
+----------------------------------+--------+------|-----------|
| task list                        | 0:15   |      |           |
| \_  First task                   |        | 0:06 | comment 1 |
| \_  Second task                  |        | 0:09 | comment 2 |
#+END: clocktable


* task list
** First task
   :PROPERTIES:
   :COMMENT: comment 1
   :LOGBOOK:
   CLOCK: [2018-12-06 Thu 13:35]--[2018-12-06 Thu 13:41] =>  0:06
   :END:
** Second task
   :PROPERTIES:
   :COMMENT: comment 2
   :LOGBOOK:
   CLOCK: [2018-12-06 Thu 13:41]--[2018-12-06 Thu 13:50] =>  0:09
   :END:
Run Code Online (Sandbox Code Playgroud)

当我使用时:properties ("COMMENT")钟表中的注释列时,它会创建,但它没有获取我在每个任务下编写的注释。另外,评论栏实际上是作为第一栏创建的,而我希望它作为最后一栏。我似乎不知道如何解决这个问题。

如何才能做到这一点?

jka*_*zan 5

事实证明我错过了:END:之后:PROPERTIES:,即

   :PROPERTIES:
   :COMMENT: comment 1
   :END: <----- THIS IS WHAT WAS MISSING 
Run Code Online (Sandbox Code Playgroud)

关于列的顺序,我在以下位置找到了帮助: https: //emacs.stackexchange.com/questions/42329/how-to-choose-the-order-of-clocktable-columns

解决方案是使用 org-mode 格式化程序并调用 .emacs init 文件中定义的函数。为了将我的COMMENT列移到最右侧,我将这是我的 .emacs 文件:

(defun my-clocktable-write (&rest args)
  "Custom clocktable writer.
Uses the default writer but shifts the first column right."
  (apply #'org-clocktable-write-default args)
  (save-excursion
    (forward-char) ;; move into the first table field
    (org-table-move-column-right)
    (org-table-move-column-right)
    (org-table-move-column-right)
    (org-table-move-column-right)
    ))
Run Code Online (Sandbox Code Playgroud)

在我的 .org 文件中我使用:

#+BEGIN: clocktable :maxlevel 4 :scope file :block today-1 :properties ("Comment") :formatter my-clocktable-write
#+CAPTION: 
Run Code Online (Sandbox Code Playgroud)

请注意以上:properties内容:formatter