如何在org模式捕获中添加标签完成?

时间:2015-07-27 21:50:10

标签: org-mode

我使用org模式的捕获功能来制作我所有的待办事项。它干净实用,让我为我的所有待办事项添加一致的内容,包括标题提示,标签提示和创建日期的自动插入。这是我的代码:

(setq org-capture-templates '((
     "t"                ; key
     "Todo"             ; description
     entry              ; type
     (file+headline "C:/.../org/notes.org" "tasks")       ; target
     "* TODO [#B] %^{Todo} :%^{Tags}: \n:PROPERTIES:\n:Created: %U\n:END:\n\n%?"  ; template
     :prepend t        ; properties
     :empty-lines 1    ; properties
     :created t        ; properties
     )))

但是,我对标签的提示迫使我从内存中输入标签。如何从以下代码设置的标签列表中添加标签:

(setq org-tag-alist `(
              ("OFFICE"   . ?o)
              ("HOME"     . ?h)
              ("ERRAND"   . ?e) ))

当我的观点位于已经创建的任务的标题中时,当我点击Cc Cc并让我通过他们的捷径单字母“o”,“h”或“e”选择标签时,会弹出此列表。< / p>

所以我的问题是:是否可以在我的捕获代码中包含此弹出式标记列表?

1 个答案:

答案 0 :(得分:9)

The built in solution is to use conda install opencv . From the help for %^g:

%^g Prompt for tags, with completion on tags in target file.

%^G Prompt for tags, with completion on all tags in all agenda files.

You can also do this "by hand" by calling some function that adds the tags. Adding tags is generally done with org-capture-templates (this is what org-set-tags is doing). So, all we have to do is call that in our template with the C-c C-c syntax:

%(func)

If you have a specific list of tags you want to select from (say (setq org-capture-templates '(( "t" ; key "Todo" ; description entry ; type (file+headline "C:/.../org/notes.org" "tasks") ; target "* TODO [#B] %^{Todo} %(org-set-tags) \n:PROPERTIES:\n:Created: %U\n:END:\n\n%?" ; template :prepend t ; properties :empty-lines 1 ; properties :created t ; properties ))) ) you can use org-tag-alist to select from it:

completing-read