简体   繁体   English

议程视图中的匹配属性

[英]matching property in agenda view

I want collect and create a block containing headlines which only has "ID" property in the headlines.我想收集并创建一个包含标题的块,标题中只有“ID”属性。

ie The headlines to be filtered looks like即要过滤的标题看起来像

* Headline 
   :PROPERTIES:
   :ID: my-id
   :END:

I am using the following code to configure the custom agenda command which does not work我正在使用以下代码来配置不起作用的自定义议程命令

(setq org-agenda-custom-commands
           '(("c" "MY Agenda"
          ((tags "ID")))))

I have read the org manual http://orgmode.org/manual/Matching-tags-and-properties.html#Matching-tags-and-properties but still unable to figure out how to do it.我已经阅读了组织手册http://orgmode.org/manual/Matching-tags-and-properties.html#Matching-tags-and-properties但仍然无法弄清楚如何去做。

Your code as such is asking it to find all headlines that have a :ID: tag on the headline.您的代码要求它查找标题上带有:ID:标记的所有标题。 To look for properties you have to use the property match feature which is listed a bit lower on the linked manual page.要查找属性,您必须使用链接手册页上列出的属性匹配功能。

Since I'm assuming you need it to match any ID and not just a specific ID you'll have to use the regexp matching by either matching ( = ) or not matching ( <> ) the regexp that follows in curly brackets.由于我假设您需要它来匹配任何 ID 而不仅仅是特定的 ID,因此您必须通过匹配 ( = ) 或不匹配 ( <> ) 大括号中的正则表达式来使用正则表达式匹配。

To match your ID property you'll need the regexp to be ID={.+} .要匹配您的 ID 属性,您需要正则表达式为ID={.+} If you used .* as the match it would also match headlines without any ID property.如果您使用.*作为匹配项,它也会匹配没有任何 ID 属性的标题。 If you have some a set of IDs you want to match that have something in common you can adjust the regexp to match them.如果你有一些你想要匹配的 ID 有一些共同点,你可以调整正则表达式来匹配它们。

So your custom agenda command will have to be:所以你的自定义议程命令必须是:

(setq org-agenda-custom-commands
           '(("c" "MY Agenda"
          ((tags "ID={.+}")))))

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

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