From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Maus Subject: [Worg] Addition to org-hacks: Remove redundant tags Date: Mon, 25 Jan 2010 20:23:38 +0100 Message-ID: <87636q56px.wl%maus.david@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: multipart/mixed; boundary="===============1238285507==" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NZUXJ-00020R-UY for emacs-orgmode@gnu.org; Mon, 25 Jan 2010 14:23:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NZUXI-0001zM-U6 for emacs-orgmode@gnu.org; Mon, 25 Jan 2010 14:23:45 -0500 Received: from [199.232.76.173] (port=56694 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NZUXI-0001z9-Oj for emacs-orgmode@gnu.org; Mon, 25 Jan 2010 14:23:44 -0500 Received: from fg-out-1718.google.com ([72.14.220.152]:10900) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NZUXI-0008OT-6D for emacs-orgmode@gnu.org; Mon, 25 Jan 2010 14:23:44 -0500 Received: by fg-out-1718.google.com with SMTP id 22so470833fge.12 for ; Mon, 25 Jan 2010 11:23:42 -0800 (PST) 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: Emacs Orgmode Mailinglist --===============1238285507== Content-Type: multipart/signed; boundary="pgp-sign-Multipart_Mon_Jan_25_20:23:35_2010-2"; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --pgp-sign-Multipart_Mon_Jan_25_20:23:35_2010-2 Content-Type: multipart/mixed; boundary="Multipart_Mon_Jan_25_20:23:35_2010-1" Content-Transfer-Encoding: 7bit --Multipart_Mon_Jan_25_20:23:35_2010-1 Content-Type: text/plain; charset=US-ASCII 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.... dmjena@jabber.org Email..... maus.david@gmail.com --Multipart_Mon_Jan_25_20:23:35_2010-1 Content-Type: application/octet-stream; type=patch Content-Disposition: attachment; filename="0001-org-hacks-Remove-redundant-tags-i.e.-tags-that-are-i.patch" Content-Transfer-Encoding: base64 RnJvbSAyMzhmNzliNzUzNzNlODZkZTFmYzM0N2ZiYjc1OWIxNDU2YjQzOGY2IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBEYXZpZCBNYXVzIDxtYXVzLmRhdmlkQGdtYWlsLmNvbT4KRGF0 ZTogTW9uLCAyNSBKYW4gMjAxMCAxOToyNDo0NCArMDEwMApTdWJqZWN0OiBbUEFUQ0hdIG9yZy1o YWNrczogUmVtb3ZlIHJlZHVuZGFudCB0YWdzIChpLmUuIHRhZ3MgdGhhdCBhcmUgaW5oZXJpdGVk IGFuZAogbG9jYWwpIG9mIGhlYWRsaW5lcwoKLS0tCiBvcmctaGFja3Mub3JnIHwgICAyOCArKysr KysrKysrKysrKysrKysrKysrKysrKysrCiAx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YSBwYXJlbnQgaGVhZGxpbmUuIgorICAgIChp bnRlcmFjdGl2ZSkKKyAgICAod2hlbiAoZXEgbWFqb3ItbW9kZSAnb3JnLW1vZGUpCisgICAgICAo c2F2ZS1leGN1cnNpb24KKyAgICAgICAgKG9yZy1tYXAtZW50cmllcyAKKyAgICAgICAgICcobGFt YmRhICgpCisgICAgICAgICAgICAobGV0ICgoYWxsdGFncyAoc3BsaXQtc3RyaW5nIChvcmctZW50 cnktZ2V0IChwb2ludCkgIkFMTFRBR1MiKSAiOiIpKQorICAgICAgICAgICAgICAgICAgbG9jYWwg aW5oZXJpdGVkIHRhZykKKyAgICAgICAgICAgICAgKGRvbGlzdCAodGFnIGFsbHRhZ3MpCisgICAg ICAgICAgICAgICAgKGlmIChnZXQtdGV4dC1wcm9wZXJ0eSAwICdpbmhlcml0ZWQgdGFnKQorICAg ICAgICAgICAgICAgICAgICAocHVzaCB0YWcgaW5oZXJpdGVkKSAocHVzaCB0YWcgbG9jYWwpKSkK KyAgICAgICAgICAgICAgKGRvbGlzdCAodGFnIGxvY2FsKQorICAgICAgICAgICAgICAgIChpZiAo bWVtYmVyIHRhZyBpbmhlcml0ZWQpIChvcmctdG9nZ2xlLXRhZyB0YWcgJ29mZikpKSkpCisgICAg ICAgICB0IG5pbCkpKSkKKyMrRU5EX1NSQwotLSAKMS42LjUKCg== --Multipart_Mon_Jan_25_20:23:35_2010-1-- --pgp-sign-Multipart_Mon_Jan_25_20:23:35_2010-2 Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iF4EABEIAAYFAktd77oACgkQma24O1pEeOZljgEArzTgWY5WAlANqbqY6irvcb+g +yBfL4Wa5xcj0E8UyzgA/1nwn0MZgkzDqjrAIK1SZQytb+koExbFL37CmjlHzUbV =9sav -----END PGP SIGNATURE----- --pgp-sign-Multipart_Mon_Jan_25_20:23:35_2010-2-- --===============1238285507== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1238285507==--