在 org-mode 中自动分配标签
Automatically assigning tags in org-mode
我讨厌在标题中已经存在标签时分配标签。我想找出一种方法让 org-mode 评估标题(最好是在我点击 "enter" 之后),如果它包含任何与我的 org-tag-alist 中的标签匹配的词,有为标题创建的那些标签。
举个例子:
如果我的 org-tag-alist 中已经有各种个人姓名和各种项目名称,甚至可能还有 "today"、"tomorrow" 和 "next week" 等术语,那么,当我输入如下内容:
"TODO Remember to ask Joe tomorrow about the due dates for the XYZ project."
然后按回车键,然后将评估标题并为该项目生成标签 :Joe:XYZ:Tomorrow:。
有没有人见过这样的事情或者对我如何自己解决有什么建议?
此函数获取条目的标题,将其拆分为单词,并将它在 org-tag-alist
或 org-tag-persistent-alist
中找到的任何单词添加为标签
(defun org-auto-tag ()
(interactive)
(let ((alltags (append org-tag-persistent-alist org-tag-alist))
(headline-words (split-string (org-get-heading t t)))
)
(mapcar (lambda (word) (if (assoc word alltags)
(org-toggle-tag word 'on)))
headline-words))
)
将这样的功能添加到 org-capture-before-finalize-hook
以自动标记新捕获的条目可能会很有用。
我讨厌在标题中已经存在标签时分配标签。我想找出一种方法让 org-mode 评估标题(最好是在我点击 "enter" 之后),如果它包含任何与我的 org-tag-alist 中的标签匹配的词,有为标题创建的那些标签。
举个例子:
如果我的 org-tag-alist 中已经有各种个人姓名和各种项目名称,甚至可能还有 "today"、"tomorrow" 和 "next week" 等术语,那么,当我输入如下内容:
"TODO Remember to ask Joe tomorrow about the due dates for the XYZ project." 然后按回车键,然后将评估标题并为该项目生成标签 :Joe:XYZ:Tomorrow:。
有没有人见过这样的事情或者对我如何自己解决有什么建议?
此函数获取条目的标题,将其拆分为单词,并将它在 org-tag-alist
或 org-tag-persistent-alist
(defun org-auto-tag ()
(interactive)
(let ((alltags (append org-tag-persistent-alist org-tag-alist))
(headline-words (split-string (org-get-heading t t)))
)
(mapcar (lambda (word) (if (assoc word alltags)
(org-toggle-tag word 'on)))
headline-words))
)
将这样的功能添加到 org-capture-before-finalize-hook
以自动标记新捕获的条目可能会很有用。