I think I did it!!!

just make a backward search

Check the following

(defun org-export-top-levels ()
 (interactive)
 (goto-char (point-max))
 (let (start (point))
       (while (re-search-backward "^* " nil t)
         (write-region start (point-at-bol) (concat (org-get-heading) ".txt"))
         (setq start (point-at-bol)))))



2008/3/18, Dimitris Kapetanakis <katepano@gmail.com>:
THANKS EVERYBODY

I was looking at something like Hugo's response. It is a click away since it saves under a "heading.txt" the next heading's text. I am trying to take a look at it with my poor knowledge of Lisp.

2008/3/17, Hugo Schmitt <hugows@gmail.com>:
Hm, I guess I sent this only to Dimitri... I'm resending it to the list..

This seems to do what you want.


(defun org-export-top-levels ()
  (interactive)
  (goto-char (point-min))
  (let (start (point))
       (while (re-search-forward "^* " nil t)
         (write-region start (point-at-bol) (concat (org-get-heading) ".txt"))
         (setq start (point-at-bol)))))

Regards,
Hugo


On Mon, Mar 17, 2008 at 4:43 PM, Daniel Clemente <n142857@gmail.com> wrote:
>
>   Mmmm... I wrote a program which can do this:
>   http://www.danielclemente.com/dislines/index.en.html
>
>   however it's not LISP.
>   I have written multilingual org files this way, but it's not comfortable since it requires several programs and processing phases. I am still looking for a solution in Emacs LISP, and if possible, one which integrates nicely with org-mode :-)
>
>
>
>
>

>  _______________________________________________
>  Emacs-orgmode mailing list
>  Remember: use `Reply All' to send replies to the list.
>  Emacs-orgmode@gnu.org
>  http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>