emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jambunathan K <kjambunathan@gmail.com>
To: "Peter Münster" <pmlists@free.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: get all todo items as lisp list
Date: Sun, 19 Feb 2012 10:31:36 +0530	[thread overview]
Message-ID: <811uprfmbz.fsf@gmail.com> (raw)
In-Reply-To: <87wr7krqd9.fsf@micropit.couberia.bzh> ("Peter \=\?utf-8\?Q\?M\?\= \=\?utf-8\?Q\?\=C3\=BCnster\=22's\?\= message of "Sat, 18 Feb 2012 18:41:22 +0100")

[-- Attachment #1: Type: text/plain, Size: 807 bytes --]

> Hi,
> Given a todo list in an org file, is there already a function, that
> converts this list to an elisp list, that contains at least heading,
> deadline and properties?

Create the following interactive function. This functions exports Org
file to a *pretty* lisp file.

--8<---------------cut here---------------start------------->8---
(defun org-export-as-lisp ()
  (or (featurep 'pp) (require 'pp))
  (let ((out-file
	 (concat (file-name-sans-extension (buffer-file-name)) ".el")))
    (pp-display-expression (org-element-parse-buffer) "*Org Data*")
    (with-current-buffer "*Org Data*"
      (write-file out-file nil))))
--8<---------------cut here---------------end--------------->8---

I am attaching sample todo.org and and the todo.el file created by the
above command.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: todo.org --]
[-- Type: text/x-org, Size: 210 bytes --]

* TODO todo-test
  DEADLINE: <2012-04-19 Thu 13:33>
   :notify:   notify-test
* TODO todo-test2
  DEADLINE: <2012-05-20 Sun 16:66>
   :notify:   notify-test2

[-- Attachment #3: todo.el --]
[-- Type: application/emacs-lisp, Size: 2189 bytes --]

[-- Attachment #4: Type: text/plain, Size: 409 bytes --]

> Example output:
> ((file "test.org" heading "TODO todo-test" deadline (111 222 333)
>        properties (notify notify-test))
>  (file "test.org" heading "TODO todo-test2" deadline (123 456 789)
>        properties (notify notify-test2)))
> Or are there functions, that could help me, to do it myself?
> (I've tried with `org-agenda-get-day-entries', but without success...)
> TIA for any help!


  parent reply	other threads:[~2012-02-19  5:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-18 17:41 get all todo items as lisp list Peter Münster
2012-02-19  0:28 ` Eric Abrahamsen
2012-02-19  5:01 ` Jambunathan K [this message]
2012-02-19 10:57   ` Nicolas Goaziou

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:

  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=811uprfmbz.fsf@gmail.com \
    --to=kjambunathan@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=pmlists@free.fr \


* 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


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).