[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Does org export have something like Lisp quasiquote and unquote?
From: |
Eric Schulte |
Subject: |
Re: [O] Does org export have something like Lisp quasiquote and unquote? |
Date: |
Wed, 19 Feb 2014 10:27:03 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Oleh <address@hidden> 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