Hello, Attached patch adds a section to the org-hacks page of Worg with a function that removes redundant tags, that is: tags that are inherited by a parent headline or the #+FILETAGS headline and local to a headline.
This function is useful for me as I generally use tags to denote a
todo's context (priv for private, work for work related etc.) and in
addition split my agenda files by context, too (work.org,
private.org). If I file new todo headlines using `org-remember' they
go in a central file (bucket.org) and I tag them so they show up on
tags searches. After refiling the context denoting tags are
duplicated -- hence I wrote this little function to remove them:
(defun dmj/org-remove-redundant-tags ()
"Remove redundant tags of headlines in current buffer.
A tag is considered redundant if it is local to a headline and
inherited by a parent headline."
(interactive)
(when (eq major-mode 'org-mode)
(save-excursion
(org-map-entries
'(lambda ()
(let ((alltags (split-string (org-entry-get (point) "ALLTAGS") ":"))
local inherited tag)
(dolist (tag alltags)
(if (get-text-property 0 'inherited tag)
(push tag inherited) (push tag local)))
(dolist (tag local)
(if (member tag inherited) (org-toggle-tag tag 'off)))))
t nil))))
Regards
-- David
--
OpenPGP... 0x99ADB83B5A4478E6
Jabber.... [email protected]
Email..... [email protected]
0001-org-hacks-Remove-redundant-tags-i.e.-tags-that-are-i.patch
Description: Binary data
pgptbz6m3jUo1.pgp
Description: PGP signature
_______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. [email protected] http://lists.gnu.org/mailman/listinfo/emacs-orgmode
