[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Self-sufficient Org file with customised export? :eval-when?
From: |
Berry, Charles |
Subject: |
Re: Self-sufficient Org file with customised export? :eval-when? |
Date: |
Fri, 1 May 2020 18:14:17 +0000 |
> On Apr 30, 2020, at 11:55 AM, akater <address@hidden> wrote:
>
[deleted - discussion of html export]
> -----
>
>
> If I may prematurely offer my vision: Common Lisp has special operator
> eval-when which specifies when the enclosed code is to be evaluated (or
> compiled). Example:
>
> (eval-when (:compile-toplevel) (defun f () ..))
>
> specifies that function f should be defined during compilation only.
>
> I believe it would be neat if Org-mode widely supported :eval-when
> header argument inspired by Common Lisp's eval-when. Usage examples
> would be:
>
> #+begin_src emacs-lisp :eval-when compile load
> ..
> #+end_src
>
You can effectively do this by using an elisp expression for the value of an
:eval arg like this:
#+begin_src emacs-lisp :eval (or (bound-and-true-p my-eval-flag) "no")
"done"
#+end_src
which honors the value of `my-eval-flag' if there is one.
You can also use a call to a src block. e.g. `:eval my-src-block(a=1,b=2)'
HTH,
Chuck
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Self-sufficient Org file with customised export? :eval-when?,
Berry, Charles <=