emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Manish <mailtomanish.sharma@gmail.com>
To: David Maus <maus.david@gmail.com>
Cc: Emacs Orgmode Mailinglist <emacs-orgmode@gnu.org>
Subject: Re: [Worg] Addition to org-hacks: Remove redundant tags
Date: Tue, 26 Jan 2010 11:04:06 +0530	[thread overview]
Message-ID: <e7cdbe31001252134t5c09cbbct233ac8ac4178f364@mail.gmail.com> (raw)
In-Reply-To: <87636q56px.wl%maus.david@gmail.com>

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.... 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
>
>

  reply	other threads:[~2010-01-26  5:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-25 19:23 [Worg] Addition to org-hacks: Remove redundant tags David Maus
2010-01-26  5:34 ` Manish [this message]
2010-01-26 16:22   ` David Maus
2010-01-26 16:54     ` Manish

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e7cdbe31001252134t5c09cbbct233ac8ac4178f364@mail.gmail.com \
    --to=mailtomanish.sharma@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=maus.david@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).