From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte <schulte.eric@gmail.com> 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: <CAA01p3qfrrW8DeATWkw4Xozj6=0Xrxn4FoEre4KDp=JMd4=g7w@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: <emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org> Received: from eggs.gnu.org ([2001:4830:134:3::10]:34086) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <schulte.eric@gmail.com>) 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 <schulte.eric@gmail.com>) 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 <schulte.eric@gmail.com>) 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 <emacs-orgmode@gnu.org>; Wed, 19 Feb 2014 09:29:24 -0800 (PST) In-Reply-To: <CAA01p3qfrrW8DeATWkw4Xozj6=0Xrxn4FoEre4KDp=JMd4=g7w@mail.gmail.com> (Oleh's message of "Wed, 19 Feb 2014 16:07:32 +0100") List-Id: "General discussions about Org-mode." <emacs-orgmode.gnu.org> List-Unsubscribe: <https://lists.gnu.org/mailman/options/emacs-orgmode>, <mailto:emacs-orgmode-request@gnu.org?subject=unsubscribe> List-Archive: <http://lists.gnu.org/archive/html/emacs-orgmode> List-Post: <mailto:emacs-orgmode@gnu.org> List-Help: <mailto:emacs-orgmode-request@gnu.org?subject=help> List-Subscribe: <https://lists.gnu.org/mailman/listinfo/emacs-orgmode>, <mailto:emacs-orgmode-request@gnu.org?subject=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 <ohwoeowho@gmail.com> Cc: org mode <emacs-orgmode@gnu.org> Oleh <ohwoeowho@gmail.com> 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 > <!-- html equivalent to above code upcased and fontified --> > #+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