Old*_*ugh 4 tags emacs org-mode
当标签已存在于标题中时,我讨厌分配标签。我想找出一种方法让 org-mode 评估标题(最好是在我点击“enter”之后),并且,如果它包含与我的 org-tag-alist 中的标签匹配的任何单词,则为这些标签创建标题。
举个例子:
如果我的 org-tag-alist 中已经有各种个人的名字和各种项目名称,甚至可能有诸如“今天”、“明天”和“下周”之类的术语,那么当我输入以下内容时:
“TODO 记得明天向 Joe 询问 XYZ 项目的截止日期。” 并按 Enter,然后将评估标题并为该项目生成标签:Joe:XYZ:Tomorrow:。
有没有人看到过这样的事情,或者对我自己如何去做有建议?
小智 6
此函数获取条目的标题,点是一个,将其拆分为单词并将其在其中找到的任何单词添加为标签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以自动标记新捕获的条目可能很有用。