emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: David Maus <maus.david@gmail.com>
To: Emacs-orgmode@gnu.org
Subject: Re: wish list: sort tasks by age
Date: Wed, 01 Jul 2009 12:24:48 +0200	[thread overview]
Message-ID: <873a9gem4v.wl%maus.david@gmail.com> (raw)
In-Reply-To: <e7cdbe30907010110i637f4b9ap6ebefe5354d5d41f@mail.gmail.com>

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.... dmjena@jabber.org
Email..... maus.david@gmail.com
ICQ....... 241051416

  reply	other threads:[~2009-07-01 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-30 20:04 wish list: sort tasks by age Christopher League
     [not found] ` <87tz1wzy1o.wl%maus.david@gmail.com>
2009-07-01  8:10   ` Manish
2009-07-01 10:24     ` David Maus [this message]
2009-07-01 11:58       ` Bastien
2009-07-01 13:26         ` Christopher League
2009-07-01 14:46           ` Bastien
2009-07-01 11:57 ` Bastien

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=873a9gem4v.wl%maus.david@gmail.com \
    --to=maus.david@gmail.com \
    --cc=Emacs-orgmode@gnu.org \
    /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).