Re: [Orgmode] wish list: sort tasks by age

2009-07-01 Thread Manish
  On Wed, Jul 1, 2009 at 12:31 PM, David Mausmaus.da...@gmail.com wrote:
   At Tue, 30 Jun 2009 16:04:39 -0400,
   Christopher League wrote:
  
   I would love to be able to sort TODOs by their age, so it becomes
   painfully obvious what I have been ignoring. Since org relies on free-
   form text (a strength), it's tricky to ensure that every item gets a
   'creation-time' property. But it doesn't need to be accurate to the
   second; even a script that added that property once every day or so
   might do the trick.
  
   Well, I'm not a elisp hacker but what comes into my mind is a custom
   function that does:
  
   for all headlines with a TODO keyword
  
   * check if property creation-time exists
  
   * add propertie creation time with current date  time if such an
   propertie does not exist
  
   and then hook this function into before-save-hook.
  
   So the question is (a) if there are functions to process all items,
   check for existence of a property and create properties (I'm quite
   certain there are) and (b) how to use them.

There are property and mapping APIs documented in the manual under
section on hacking.

-- 
Manish


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] wish list: sort tasks by age

2009-07-01 Thread David Maus
At Wed, 1 Jul 2009 13:40:21 +0530,
Manish wrote:
 
 There are property and mapping APIs documented in the manual under
 section on hacking.

And what a fun it is to train my elisp skills. A first hack that seems to work:

(defun dmj/org-assure-creation-property ()
  Process all orgmode entries of current buffer that do not
  match a defined search string
  (interactive)
  (org-map-entries 'dmj/org-insert-creation-property +Creation_Time=\\)
)

(defun dmj/org-insert-creation-property ()
  Insert Creation-Property in Orgmode entry at point
  (let ((stamp (format-time-string (cdr org-time-stamp-formats) 
(current-time 
(setq stamp (concat [ (substring stamp 1 -1) ]))
(org-entry-put (point-marker) Creation_Time stamp))
)

The first function (dmj/assure-creation-property) processes every
entry in current buffer that match the search query Creation_Time=,
i.e. entries with an empty or no Creation_Time property at all and
calls dmj/org-insert-creation-property to insert a Creation_Time
property with the current time into this entry.

The tag search query should be refined to only match headlines with
(certain) TODO keywords.

The first function is defined as interactive so you can call it via
M-x -- and of course this is just a fast hack with no warranty at all.

Regards

  -- David

-- 
OpenPGP... 0x316F4BE4670716FD
Jabber dmj...@jabber.org
Email. maus.da...@gmail.com
ICQ... 241051416


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] wish list: sort tasks by age

2009-07-01 Thread Bastien
Christopher League lea...@contrapunctus.net writes:

 I would love to be able to sort TODOs by their age, so it becomes
 painfully obvious what I have been ignoring.  Since org relies on free- 
 form text (a strength), it's tricky to ensure that every item gets a
 creation-time' property.  But it doesn't need to be accurate to the
 second; even a script that added that property once every day or so
 might do the trick.

Check org-expiry.el in Org's contrib directory, it might do what you
want.  (I still need to write a tutorial about this.)

-- 
 Bastien


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


Re: [Orgmode] wish list: sort tasks by age

2009-07-01 Thread Bastien
David Maus maus.da...@gmail.com writes:

 At Wed, 1 Jul 2009 13:40:21 +0530,
 Manish wrote:
 
 There are property and mapping APIs documented in the manual under
 section on hacking.

 And what a fun it is to train my elisp skills. A first hack that seems to 
 work:

 (defun dmj/org-assure-creation-property ()
   Process all orgmode entries of current buffer that do not
   match a defined search string
   (interactive)
   (org-map-entries 'dmj/org-insert-creation-property +Creation_Time=\\)
 )

 (defun dmj/org-insert-creation-property ()
   Insert Creation-Property in Orgmode entry at point
   (let ((stamp (format-time-string (cdr org-time-stamp-formats) 
 (current-time 
 (setq stamp (concat [ (substring stamp 1 -1) ]))
 (org-entry-put (point-marker) Creation_Time stamp))
 )

 The first function (dmj/assure-creation-property) processes every
 entry in current buffer that match the search query Creation_Time=,
 i.e. entries with an empty or no Creation_Time property at all and
 calls dmj/org-insert-creation-property to insert a Creation_Time
 property with the current time into this entry.

Thanks for this David -- you might also have a look at the code in
org-expiry.el.  If there is anything there that you want to improve,
please do so!

-- 
 Bastien


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] wish list: sort tasks by age

2009-06-30 Thread Christopher League
I would love to be able to sort TODOs by their age, so it becomes  
painfully obvious what I have been ignoring.  Since org relies on free- 
form text (a strength), it's tricky to ensure that every item gets a  
'creation-time' property.  But it doesn't need to be accurate to the  
second; even a script that added that property once every day or so  
might do the trick.


Since I commit my agenda files to git every day or so, I can actually  
get an approximation to this with git-blame... grep the TODO  
headlines, then sort by commit date.  It's pretty hackish, and I'm not  
sure I want to go to the trouble of integrating that raw data with the  
agenda view, if there's a better way within org.


Ideas? Thanks!
Chris



___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode