From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Does org export have something like Lisp quasiquote and unquote? Date: Wed, 19 Feb 2014 10:27:03 -0700 Message-ID: <87eh2zf1y0.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:34086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGAxe-0006z9-7x for emacs-orgmode@gnu.org; Wed, 19 Feb 2014 12:29:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WGAxZ-0001M9-1i for emacs-orgmode@gnu.org; Wed, 19 Feb 2014 12:29:30 -0500 Received: from mail-oa0-x229.google.com ([2607:f8b0:4003:c02::229]:51088) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WGAxY-0001Kh-Sp for emacs-orgmode@gnu.org; Wed, 19 Feb 2014 12:29:24 -0500 Received: by mail-oa0-f41.google.com with SMTP id o6so377695oag.14 for ; Wed, 19 Feb 2014 09:29:24 -0800 (PST) In-Reply-To: (Oleh's message of "Wed, 19 Feb 2014 16:07:32 +0100") 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: Oleh Cc: org mode Oleh writes: > Hi all, > > I'd like to perform Elisp operations on org-mode buffer while exporting. > > Something like this (the comma unquotes like in Lisp quasiquote): > > ,(setq foo "(defun square (x)\n (* x x))") > > #+begin_src lisp > ,foo > #+end_src > #+BEGIN_HTML > ,(with-current-buffer > (with-current-buffer (get-buffer-create "*temp*") > (lisp-mode) > (insert (upcase foo)) > (htmlize-buffer)) > (kill-buffer "*temp*") > (buffer-string)) > #+END_HTML > > And I want it to be equivalent to: > > #+begin_src lisp > (defun square (x) > (* x x)) > #+end_src > #+BEGIN_HTML > > #+END_HTML > > Is something like this possible? > > regards, > Oleh > The following will do what you want. set the value #+begin_src lisp :results silent (defvar foo '(defun square (x) (* x x))) #+end_src #+begin_src lisp :results output pp code foo #+end_src #+RESULTS: #+BEGIN_SRC lisp (DEFUN SQUARE (X) (* X X)) #+END_SRC Best, -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D