emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [ANN] Org Elements in contrib


From: Michael Brand
Subject: Re: [O] [ANN] Org Elements in contrib
Date: Sun, 10 Jun 2012 18:40:59 +0200

Hi Nicolas

On Mon, Nov 21, 2011 at 7:50 PM, Nicolas Goaziou <address@hidden> wrote:
> I've added org-element.el in contrib directory. It is a complete parser
> and interpreter for Org syntax.
>
> [...]
>
> the following code will parse the buffer, interpret the parsed
> tree, and create a canonical copy of it (no indentation, lowercased
> blocks, standard keywords):
>
> #+begin_src org
> (let ((out (org-element-interpret-data (org-element-parse-buffer))))
>  (switch-to-buffer (get-buffer-create "*Bijectivep*"))
>  (erase-buffer)
>  (insert out)
>  (goto-char (point-min))
>  (org-mode))
> #+end_src
>
> [...]
>
> Feedback is welcome.

Good to mention is also this code to show the pretty print formatted
lisp object representation of the current Org buffer:

#+BEGIN_SRC emacs-lisp
  (let ((out (org-element-parse-buffer)))
    (setq eval-expression-print-length nil)
    (setq eval-expression-print-level  nil)
    (switch-to-buffer (get-buffer-create "*prettyprint*"))
    (erase-buffer)
    (insert (pp-to-string out))
    (goto-char (point-min))
    (emacs-lisp-mode)
    (setq truncate-lines t))
#+END_SRC

Not sure if the following should be supported by
org-element-interpret-data:

#+BEGIN_SRC org
  ,variable declaration in some programming languages:
  ,- Perl :: the variable declaration can be implicit
  ,- C ::
  ,  #+BEGIN_SRC C
  ,    time_t variable_name;
  ,  #+END_SRC
#+END_SRC

The above command for Bijectivep of (org-element-interpret-data
(org-element-parse-buffer)) shows BEGIN_SRC on the same line as
"- C ::" but I expect it on a separate line like in the original. The above
command for prettyprint of (org-element-parse-buffer) alone looks ok
to me.

Michael



reply via email to

[Prev in Thread] Current Thread [Next in Thread]