From mboxrd@z Thu Jan 1 00:00:00 1970 From: Manish Subject: Re: [Worg] Addition to org-hacks: Remove redundant tags Date: Tue, 26 Jan 2010 11:04:06 +0530 Message-ID: References: <87636q56px.wl%maus.david@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZe4O-0000Lc-QO for emacs-orgmode@gnu.org; Tue, 26 Jan 2010 00:34:32 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZe4K-0000IY-4t for emacs-orgmode@gnu.org; Tue, 26 Jan 2010 00:34:32 -0500 Received: from [199.232.76.173] (port=38184 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZe4K-0000IR-1Y for emacs-orgmode@gnu.org; Tue, 26 Jan 2010 00:34:28 -0500 Received: from mail-iw0-f186.google.com ([209.85.223.186]:56906) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NZe4J-0001QU-PT for emacs-orgmode@gnu.org; Tue, 26 Jan 2010 00:34:27 -0500 Received: by iwn16 with SMTP id 16so533304iwn.5 for ; Mon, 25 Jan 2010 21:34:27 -0800 (PST) In-Reply-To: <87636q56px.wl%maus.david@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: David Maus Cc: Emacs Orgmode Mailinglist Applied to Worg. Thanks --=20 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. =A0After refiling the context denoting tags are > duplicated -- hence I wrote this little function to remove them: > > (defun dmj/org-remove-redundant-tags () > =A0"Remove redundant tags of headlines in current buffer. > > =A0A tag is considered redundant if it is local to a headline and > =A0inherited by a parent headline." > =A0(interactive) > =A0(when (eq major-mode 'org-mode) > =A0 =A0(save-excursion > =A0 =A0 =A0(org-map-entries > =A0 =A0 =A0 '(lambda () > =A0 =A0 =A0 =A0 =A0(let ((alltags (split-string (org-entry-get (point) "A= LLTAGS") ":")) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0local inherited tag) > =A0 =A0 =A0 =A0 =A0 =A0(dolist (tag alltags) > =A0 =A0 =A0 =A0 =A0 =A0 =A0(if (get-text-property 0 'inherited tag) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(push tag inherited) (push tag local))= ) > =A0 =A0 =A0 =A0 =A0 =A0(dolist (tag local) > =A0 =A0 =A0 =A0 =A0 =A0 =A0(if (member tag inherited) (org-toggle-tag tag= 'off))))) > =A0 =A0 =A0 t nil)))) > > Regards > > =A0-- David > > -- > OpenPGP... 0x99ADB83B5A4478E6 > Jabber.... dmjena@jabber.org > Email..... maus.david@gmail.com > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode > >