Automatic tagging in org mode

I hate to assign tags when the tag already exists in the header. I would like to figure out a way for org-mode to evaluate the title (preferably right after I hit enter), and if it contains any words that match the tags in my org-tag-alist, create those tags for title.

As an example:

If I have different individual names and different project names and maybe even terms like "today", "tomorrow" and "next week" already in my org-tag-alist when I type something like :

"TODO Remember to ask Joe tomorrow for the timing of Project XYZ." and hit enter then the title will be evaluated and tags: Joe: XYZ: Tomorrow: will be created for the item.

Has anyone seen something like this or had a suggestion on how I can do this myself?

+3


source to share


1 answer


This function gets the post title, point one, breaks it down into words and adds as a tag any word it finds in org-tag-alist

ororg-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))
    )

      



It might be helpful to add a function like this in org-capture-before-finalize-hook

to automatically tag new entries.

+2


source







All Articles