emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: David Maus
Subject: Re: [Orgmode] wish list: sort tasks by age
Date: Wed, 01 Jul 2009 12:24:48 +0200
User-agent: Wanderlust/2.15.6 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (Goj┼Ź) APEL/10.7 Emacs/23.0.95 (i486-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

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.... address@hidden
Email..... address@hidden
ICQ....... 241051416




reply via email to

[Prev in Thread] Current Thread [Next in Thread]