anhnmncb, this helps you?

(defun org-to-anhnmncb ()
  (interactive)
  (goto-char (point-min))
  (let ((curlevel 0))
    (while (< (point) (point-max))
      (goto-char (point-at-bol))
      (cond
       ((looking-at "\\(\\*+\\)\\s-*")
        (setq curlevel (1- (length (match-string 1))))
        (replace-match (make-string curlevel ?\t)))
       ((looking-at "\\s-*")
        (replace-match (concat (make-string curlevel ?\t) "- "))))
      (forward-line 1))))

my test was this:

* level1
  item
** level2
   item
   item
*** level3
    item
    item
** level2 again
   item
   item

which gets converted into:

level1
- item
    level2
    - item
    - item
        level3
        - item
        - item
    level2 again
    - item
    - item


hope this helps,
hugo



On Mon, Aug 4, 2008 at 10:43 PM, Eddward DeVilla <[EMAIL PROTECTED]> wrote:

> I don't know if you use perl at all.  My first guess is:
>
>    perl -pe's/^(\*+)(\s+.*)$/("\t"x length$1).$2/e' < TODO.org > TODO.txt
>
> Having tried it on a live file, I don't think the results are very
> pleasing  Replacing a single character '*' with a tab creates a
> formatting mess with any other text in the file.
>
> Edd
>
> On Mon, Aug 4, 2008 at 12:39 PM, anhnmncb <[EMAIL PROTECTED]> wrote:
> > anhnmncb <[EMAIL PROTECTED]> writes:
> >
> >> Carsten Dominik <[EMAIL PROTECTED]> writes:
> >>
> >>> On Jul 26, 2008, at 9:52 AM, anhnmncb wrote:
> >>>
> >>>> "Hugo Schmitt" <[EMAIL PROTECTED]> writes:
> >>>>
> >>>>> What are the odds that Carsten has plans to export to a format
> >>>>> *you* just invented?
> >>>> Oh, my pda app projekt can import this format of file, but if all of
> >>>> you
> >>>> think it's no use, nervermind.
> >>>
> >>> Hey, why the huff?
> >>>
> >>> The point is, you have not given us any chance at all to
> >>> think it might be of any use!
> >>>
> >>> - Carsten
> >>>
> >> Sorry for delay, I can't reach the app website[1] right now, when it
> >> can, I will provide the relavent information.
> >>
> >> [1] http://www.kylom.com/
> >
> > Sorry, I can't find more useful info, the app just says it can import
> > the txt file which has different level of indents. So I think replace
> > star(*) with <tab> is enough. Such like this:
> >
> > Org file              -->  txt file
> > --------------------       --------------------
> > |* level 1                 |level 1
> > |** level 2           -->  |<tab>level 2
> > |<tab>- item               |<tab>- item
> > |*** level 3               |<tab><tab>level 3
> > --------------------       --------------------
> >
> > I'm not a programmer, so if my request is stupid and easy to achieve by
> > any other way, please let me know.
> >
> >>
> >>>>
> >>>>>
> >>>>> On Fri, Jul 25, 2008 at 3:47 PM, anhnmncb <[EMAIL PROTECTED]>
> wrote:
> >>>>>
> >>>>>   Carsten Dominik <[EMAIL PROTECTED]> writes:
> >>>>>
> >>>>>> We do not have an exporter that can do this right now.
> >>>>>>
> >>>>>> - Carsten
> >>>>>   Will it come in furture?
> >>>>>>
> >>>>>> On Jul 24, 2008, at 4:59 PM, anhnmncb wrote:
> >>>>>>
> >>>>>>   I want to export org to plan text, which pattern is:
> >>>>>>   --------------------
> >>>>>>   |level 1
> >>>>>>   |<tab>level 2
> >>>>>>   |<tab>- item
> >>>>>>   |<tab><tab>level 3
> >>>>>>   --------------------
> >>>>>>   instead of
> >>>>>>   --------------------
> >>>>>>   |* level 1
> >>>>>>   |** level 2
> >>>>>>   |<tab>- item
> >>>>>>   |*** level 3
> >>>>>>   --------------------
> >>>>>>   --
> >>>>>>   Regards,
> >>>>>>
> >>>>>>    anhnmncb
> >>>>>>   gpg key: 44A31344
> >>>>>>
> >>>>>>   _______________________________________________
> >>>>>>   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
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> 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
> >>>>>
> >>>>>   --
> >>>>>   Regards,
> >>>>>
> >>>>>    anhnmncb
> >>>>>    gpg key: 44A31344
> >>>>>
> >>>>>   _______________________________________________
> >>>>>   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
> >>>>>
> >>>>> _______________________________________________
> >>>>> 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
> >>>>
> >>>> --
> >>>> Regards,
> >>>>
> >>>> anhnmncb
> >>>> gpg key: 44A31344
> >>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> 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
> >>>
> >>>
> >>>
> >>> _______________________________________________
> >>> 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
> >>>
> >
> > --
> > Regards,
> >
> >  anhnmncb
> >  gpg key: 44A31344
> >
> >
> >
> > _______________________________________________
> > 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
> >
>
>
> _______________________________________________
> 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
>
_______________________________________________
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

Reply via email to