From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael Brand Subject: Re: [ANN] Org Elements in contrib Date: Sun, 10 Jun 2012 18:40:59 +0200 Message-ID: References: <87ty5xxqbu.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from eggs.gnu.org ([208.118.235.92]:42957) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdlCJ-0006FH-Hf for emacs-orgmode@gnu.org; Sun, 10 Jun 2012 12:41:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SdlCH-0007if-Qf for emacs-orgmode@gnu.org; Sun, 10 Jun 2012 12:41:03 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:37688) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SdlCH-0007iY-HS for emacs-orgmode@gnu.org; Sun, 10 Jun 2012 12:41:01 -0400 Received: by wefh52 with SMTP id h52so2218425wef.0 for ; Sun, 10 Jun 2012 09:40:59 -0700 (PDT) In-Reply-To: <87ty5xxqbu.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Nicolas Goaziou Cc: Org Mode List Hi Nicolas On Mon, Nov 21, 2011 at 7:50 PM, Nicolas Goaziou 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