From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: wish list: sort tasks by age Date: Wed, 01 Jul 2009 13:58:09 +0200 Message-ID: <87d48kipim.fsf@bzg.ath.cx> References: <9FE27D7D-3CB3-4B17-9061-0AFF0FCD0AFF@contrapunctus.net> <87tz1wzy1o.wl%maus.david@gmail.com> <873a9gem4v.wl%maus.david@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MLySA-0006nO-96 for emacs-orgmode@gnu.org; Wed, 01 Jul 2009 07:58:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MLyS5-0006mK-UR for Emacs-orgmode@gnu.org; Wed, 01 Jul 2009 07:58:17 -0400 Received: from [199.232.76.173] (port=36874 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MLyS4-0006m8-6Y for Emacs-orgmode@gnu.org; Wed, 01 Jul 2009 07:58:12 -0400 Received: from fg-out-1718.google.com ([72.14.220.159]:58999) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MLyS3-00009k-FY for Emacs-orgmode@gnu.org; Wed, 01 Jul 2009 07:58:11 -0400 Received: by fg-out-1718.google.com with SMTP id l26so235524fgb.7 for ; Wed, 01 Jul 2009 04:58:10 -0700 (PDT) In-Reply-To: <873a9gem4v.wl%maus.david@gmail.com> (David Maus's message of "Wed, 01 Jul 2009 12:24:48 +0200") 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: David Maus Cc: Emacs-orgmode@gnu.org David Maus 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