Re: [Orgmode] [Worg] Addition to org-hacks: Remove redundant tags

2010-01-26 Thread David Maus
At Tue, 26 Jan 2010 11:04:06 +0530,
Manish wrote:

 Applied to Worg.

 Thanks

Ooops, attached patch fixes a small glitch in this function that
prevented it working on headlines without tags.

 -- David

--
OpenPGP... 0x99ADB83B5A4478E6
Jabber dmj...@jabber.org
Email. maus.da...@gmail.com


0001-fix-small-glitch-in-dmj-org-remove-redundant-tags.patch
Description: Binary data


pgpRgobgRhal7.pgp
Description: PGP signature
___
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


Re: [Orgmode] [Worg] Addition to org-hacks: Remove redundant tags

2010-01-26 Thread Manish
On Tue, Jan 26, 2010 at 9:52 PM, David Maus wrote:
 At Tue, 26 Jan 2010 11:04:06 +0530,
 Manish wrote:

 Applied to Worg.

 Thanks

 Ooops, attached patch fixes a small glitch in this function that
 prevented it working on headlines without tags.

Applied to Worg.

Thanks
-- 
Manish


___
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


[Orgmode] [Worg] Addition to org-hacks: Remove redundant tags

2010-01-25 Thread David Maus
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 dmj...@jabber.org
Email. maus.da...@gmail.com


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.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] [Worg] Addition to org-hacks: Remove redundant tags

2010-01-25 Thread Manish
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 dmj...@jabber.org
 Email. maus.da...@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




___
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