简体   繁体   English

将注释列添加到emacs组织模式时钟表

[英]Add comment column to emacs org-mode clock table

I really want to be able to log work with comment on each item, eg: 我真的很想能够记录每个项目的评论,例如:

#+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:

When I use the :properties ("COMMENT") the comment column in the clock table is created, but it does not get the comments I write under each task. 当我使用:properties ("COMMENT") ,会在时钟表中创建注释列,但它不会获得我在每个任务下编写的注释。 Also, the comment column is actually created as the first column, whereas I would like it as the last one. 另外,comment列实际上是创建为第一列,而我希望它是最后一个列。 I cannot seem to figure out how to solve this. 我似乎无法弄清楚该如何解决。

How can this be done? 如何才能做到这一点?

It turns out I was missing an :END: after the :PROPERTIES: , ie 原来我在:PROPERTIES:之后缺少了:END: :PROPERTIES:

   :PROPERTIES:
   :COMMENT: comment 1
   :END: <----- THIS IS WHAT WAS MISSING 

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

The solution was to use the org-mode formatter and call a function defined in the .emacs init file. 解决方案是使用组织模式格式化程序并调用.emacs初始化文件中定义的函数。 To move my COMMENT column to the far right, I put this is my .emacs file: 要将我的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)
    ))

And in my .org file I use: 在我的.org文件中,我使用:

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

note the :properties and :formatter above. 注意上面的:properties:formatter

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM