Re: [O] get all todo items as lisp list

2012-02-19 Thread Nicolas Goaziou
Hello,

Jambunathan K kjambunat...@gmail.com writes:

 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.

 (defun org-export-as-lisp ()
   (interactive)
   (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*

Nice example.

Also, the OP may replace (org-element-parse-buffer) with
(org-element-parse-buffer 'headline) for quicker results, since parsed
headlines already contain all the required information.


Regards,

-- 
Nicolas Goaziou



[O] get all todo items as lisp list

2012-02-18 Thread Peter Münster
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?

Example input:
--8---cut here---start-8---
* TODO todo-test
  DEADLINE: 2012-04-19 Thu 13:33
   :PROPERTIES:
   :notify:   notify-test
   :END:
* TODO todo-test2
  DEADLINE: 2012-05-20 Sun 16:66
   :PROPERTIES:
   :notify:   notify-test2
   :END:
--8---cut here---end---8---

Example output:
--8---cut here---start-8---
((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)))
--8---cut here---end---8---

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!
-- 
   Peter




Re: [O] get all todo items as lisp list

2012-02-18 Thread Eric Abrahamsen
On Sun, Feb 19 2012, Peter Münster wrote:

 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?

 Example input:
 * TODO todo-test
   DEADLINE: 2012-04-19 Thu 13:33
:PROPERTIES:
:notify:   notify-test
:END:
 * TODO todo-test2
   DEADLINE: 2012-05-20 Sun 16:66
:PROPERTIES:
:notify:   notify-test2
:END:

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

Hi,

If you load org-element.el from contrib/, I think the function
`org-element-parse-buffer' does what you want (and probably a whole lot
more).

Eric

-- 
GNU Emacs 24.0.93.1 (i686-pc-linux-gnu, GTK+ Version 2.24.10)
 of 2012-02-16 on pellet
Org-mode version 7.8.03 (release_7.8.03.362.g1cc2)




Re: [O] get all todo items as lisp list

2012-02-18 Thread Jambunathan K

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




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


todo.el
Description: todo.el



 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!

--