[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] [Worg] Addition to org-hacks: Remove redundant tags
From: |
Manish |
Subject: |
Re: [Orgmode] [Worg] Addition to org-hacks: Remove redundant tags |
Date: |
Tue, 26 Jan 2010 11:04:06 +0530 |
Applied to Worg.
Thanks
--
Manish
On Tue, Jan 26, 2010 at 12:53 AM, David Maus wrote:
> 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.... address@hidden
> Email..... address@hidden
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>
>