Emacs 如何在组织模式下匹配/解析任务结束时的注释
我正在寻找一种方法来匹配我所谓的“注释”,即组织任务的最后一行(或一组行),上面写着:“Emacs 如何在组织模式下匹配/解析任务结束时的注释,emacs,elisp,org-mode,Emacs,Elisp,Org Mode,我正在寻找一种方法来匹配我所谓的“注释”,即组织任务的最后一行(或一组行),上面写着:“这些是任务的注释。” 我已经编写了一个很长的regexp,可以完成这项工作,但我希望org模式已经提供了更好的功能: "^\\(\\*\\*\\)\\(?: +\\(Active\\|Next Action\\|Hold\\|Reference\\|Delegated\\|Postponed\\|Waiting\\|Someday\\|Planning\\|Canceled\\|None\\)\\)?\\(
这些是任务的注释。
”
我已经编写了一个很长的regexp,可以完成这项工作,但我希望org模式已经提供了更好的功能:
"^\\(\\*\\*\\)\\(?: +\\(Active\\|Next Action\\|Hold\\|Reference\\|Delegated\\|Postponed\\|Waiting\\|Someday\\|Planning\\|Canceled\\|None\\)\\)?\\(?: +\\(\\[#.\\]\\)\\)?\\(?: +\\(.*?\\)\\)??\\(?:[ ]+\\(:[[:alnum:]_@#%:]+:\\)\\)?[ ]*\\(?:\\(\n\\)\\)?\\(?: +\\(DEADLINE:\\|SCHEDULED:\\)\\)?\\(?: +\\(<\\)\\([^>]+\\)\\(>\\)\\)?\\(?: +\\(DEADLINE:\\|SCHEDULED:\\)\\)?\\(?: +\\(<\\)\\([^>]+\\)\\(>\\)\\)?\\(?:\\(\n\\)\\)?\\(?: +\\(CLOSED:.*\\)\\)?\\(?:\\(\n\\)\\)?\\(?: +\\(:PROPERTIES:\\)\\)?\\(?:\\(\n\\)\\)?\\(?: +\\(:ToodledoID:\\)\\)?\\(?: +\\([0-9]+\\)\\)?\\(?:\\(\n\\)\\)?\\(?: +\\(:ToodledoFolder:\\)\\)?\\(?: +\\(EVENTS\\|TASKS\\|UNDATED\\|DONE\\|CONTACT\\)\\)?\\(?:\\(\n\\)\\)\\(?: +\\(:Hash:\\)\\)?\\(?: +\\(.*+\\)\\)?\\(?:\\(\n\\)\\)?\\(?: +\\(:END:\\)\\)?\\(?:\\(\n\\)\\)?\\(.*\\(?:\n.*\\)*?\\)\\(?:^\\)"
(消息“%s”(组织元素映射(组织元素解析缓冲区)“段落”标识为nil t))
提供以下信息:
(paragraph
(:begin 244
:end 276
:contents-begin 244
:contents-end 276
:post-blank 0
:post-affiliated 244
:parent (section
(:begin 58
:end 276
:contents-begin 58
:contents-end 276
:post-blank 0
:parent (headline
(:raw-value 0
@
Title of the task.
:begin 1
:end 276
:pre-blank 0
:hiddenp nil
:contents-begin 58
:contents-end 276
:level 2
:priority 65
:tags (event lawlist)
:todo-keyword Delegated
:todo-type todo
:post-blank 0
:footnote-section-p nil
:archivedp nil
:commentedp nil
:quotedp nil
:deadline (timestamp
(:type active
:raw-value <2014-01-11 Sat 08:00>
:year-start 2014
:month-start 1
:day-start 11
:hour-start 8
:minute-start 0
:year-end 2014
:month-end 1
:day-end 11
:hour-end 8
:minute-end 0
:begin 71
:end 95
:post-blank 2))
:scheduled (timestamp
(:type active
:raw-value <2014-01-11 Sat>
:year-start 2014
:month-start 1
:day-start 11
:hour-start nil
:minute-start nil
:year-end 2014
:month-end 1
:day-end 11
:hour-end nil
:minute-end nil
:begin 106
:end 122
:post-blank 0))
:TOODLEDOID 353081871
:TOODLEDOFOLDER EVENTS
:HASH 20657e7586fcc67da708789d7bbc0fbd
:CATEGORY .scratch
:title (0 @ Title of the task.)
:parent (org-data nil #4)) #2))
(planning (:closed nil
:deadline (timestamp
(:type active
:raw-value <2014-01-11 Sat 08:00>
:year-start 2014
:month-start 1
:day-start 11
:hour-start 8
:minute-start 0
:year-end 2014
:month-end 1
:day-end 11
:hour-end 8
:minute-end 0
:begin 71
:end 95
:post-blank 2))
:scheduled (timestamp
(:type active
:raw-value <2014-01-11 Sat>
:year-start 2014
:month-start 1
:day-start 11
:hour-start nil
:minute-start nil
:year-end 2014
:month-end 1
:day-end 11
:hour-end nil
:minute-end nil
:begin 106
:end 122
:post-blank 0))
:begin 58
:end 123
:post-blank 0
:parent #2))
(property-drawer (:begin 123
:end 244
:hiddenp nil
:contents-begin 139
:contents-end 235
:post-blank 0
:post-affiliated 123
:parent #2)
(node-property (:key ToodledoID
:value 353081871
:begin 139
:end 165
:post-blank 0
:parent #3))
(node-property (:key ToodledoFolder
:value EVENTS
:begin 165
:end 192
:post-blank 0
:parent #3))
(node-property (:key Hash
:value 20657e7586fcc67da708789d7bbc0fbd
:begin 192
:end 235
:post-blank 0
:parent #3)))
#0))
These are the notes of the task.)
(第
(:开始244)
:完276
:内容开始244
:目录完276
:后置空白0
:邮政编码244
:家长(部分)
(:开始
:完276
:内容开始58
:目录完276
:后置空白0
:家长(标题)
(:原始值0)
@
任务的标题。
:开始1
:完276
:预空白0
:hiddenp nil
:内容开始58
:目录完276
:二级
:优先权65
:标记(事件列表)
:todo关键字已委派
:todo类型todo
:后置空白0
:脚注-p节无
:archivedp无
:无评论
:quotedp零
:截止日期(时间戳)
(:类型活动)
:原始值
:2014年初
:月初1
:第11天开始
:小时开始8
:分钟开始0
:2014年底
:月底1
:第11天结束
:小时结束8
:分钟结束0
:开始71
:完95
:空白后(2))
:预定(时间戳)
(:类型活动)
:原始值
:2014年初
:月初1
:第11天开始
:小时开始零
:分钟开始零
:2014年底
:月底1
:第11天结束
:小时结束零
:分钟结束零
:开始106
:完122
:后置空白(0))
:TOODLEDOID 353081871
:TOODLEDOFOLDER事件
:散列20657e7586fcc67da708789d7bbc0fbd
:类别。刮痕
:title(0@任务标题)
:父级(组织数据无(4))(2))
(规划(:无)
:截止日期(时间戳)
(:类型活动)
:原始值
:2014年初
:月初1
:第11天开始
:小时开始8
:分钟开始0
:2014年底
:月底1
:第11天结束
:小时结束8
:分钟结束0
:开始71
:完95
:空白后(2))
:预定(时间戳)
(:类型活动)
:原始值
:2014年初
:月初1
:第11天开始
:小时开始零
:分钟开始零
:2014年底
:月底1
:第11天结束
:小时结束零
:分钟结束零
:开始106
:完122
:后置空白(0))
:开始58
:完123
:后置空白0
:家长#2)
(属性抽屉(:begin 123)
:完244
:hiddenp nil
:内容开始139
:目录结束235
:后置空白0
:邮政编码123
:家长#2)
(节点属性(:key ToodledoID)
:值353081871
:开始139
:完165
:后置空白0
:家长#3)
(节点属性(:key ToodledoFolder)
:价值事件
:开始165
:完192
:后置空白0
:家长#3)
(节点属性::密钥散列)
:值20657e7586fcc67da708789d7bbc0fbd
:开始192
:完235
(defvar lawlist-org-heading-regexp
"^\\(\\*+\\)\\(?: +\\(.*?\\)\\)?[ \t]*\\(\n.*DEADLINE.*$\\)"
"Custom match org headline, plus the second line with a deadline.")
(setq txt
(save-excursion
(org-back-to-heading t)
(when (looking-at org-heading-regexp)
(concat
(match-string 1)
" "
(match-string 2)
(if (and (looking-at lawlist-org-heading-regexp) (match-string 3))
(match-string 3))
"\n" )))) )
(paragraph
(:begin 244
:end 276
:contents-begin 244
:contents-end 276
:post-blank 0
:post-affiliated 244
:parent (section
(:begin 58
:end 276
:contents-begin 58
:contents-end 276
:post-blank 0
:parent (headline
(:raw-value 0
@
Title of the task.
:begin 1
:end 276
:pre-blank 0
:hiddenp nil
:contents-begin 58
:contents-end 276
:level 2
:priority 65
:tags (event lawlist)
:todo-keyword Delegated
:todo-type todo
:post-blank 0
:footnote-section-p nil
:archivedp nil
:commentedp nil
:quotedp nil
:deadline (timestamp
(:type active
:raw-value <2014-01-11 Sat 08:00>
:year-start 2014
:month-start 1
:day-start 11
:hour-start 8
:minute-start 0
:year-end 2014
:month-end 1
:day-end 11
:hour-end 8
:minute-end 0
:begin 71
:end 95
:post-blank 2))
:scheduled (timestamp
(:type active
:raw-value <2014-01-11 Sat>
:year-start 2014
:month-start 1
:day-start 11
:hour-start nil
:minute-start nil
:year-end 2014
:month-end 1
:day-end 11
:hour-end nil
:minute-end nil
:begin 106
:end 122
:post-blank 0))
:TOODLEDOID 353081871
:TOODLEDOFOLDER EVENTS
:HASH 20657e7586fcc67da708789d7bbc0fbd
:CATEGORY .scratch
:title (0 @ Title of the task.)
:parent (org-data nil #4)) #2))
(planning (:closed nil
:deadline (timestamp
(:type active
:raw-value <2014-01-11 Sat 08:00>
:year-start 2014
:month-start 1
:day-start 11
:hour-start 8
:minute-start 0
:year-end 2014
:month-end 1
:day-end 11
:hour-end 8
:minute-end 0
:begin 71
:end 95
:post-blank 2))
:scheduled (timestamp
(:type active
:raw-value <2014-01-11 Sat>
:year-start 2014
:month-start 1
:day-start 11
:hour-start nil
:minute-start nil
:year-end 2014
:month-end 1
:day-end 11
:hour-end nil
:minute-end nil
:begin 106
:end 122
:post-blank 0))
:begin 58
:end 123
:post-blank 0
:parent #2))
(property-drawer (:begin 123
:end 244
:hiddenp nil
:contents-begin 139
:contents-end 235
:post-blank 0
:post-affiliated 123
:parent #2)
(node-property (:key ToodledoID
:value 353081871
:begin 139
:end 165
:post-blank 0
:parent #3))
(node-property (:key ToodledoFolder
:value EVENTS
:begin 165
:end 192
:post-blank 0
:parent #3))
(node-property (:key Hash
:value 20657e7586fcc67da708789d7bbc0fbd
:begin 192
:end 235
:post-blank 0
:parent #3)))
#0))
These are the notes of the task.)