emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Berry, Charles" via "General discussions about Org-mode." <emacs-orgmode@gnu.org>
To: akater <nuclearspace@gmail.com>
Cc: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Self-sufficient Org file with customised export? :eval-when?
Date: Fri, 1 May 2020 18:14:17 +0000	[thread overview]
Message-ID: <B4B54324-5796-4A05-B039-36E24274E403@ucsd.edu> (raw)
In-Reply-To: <87imhgyfai.fsf@gmail.com>



> On Apr 30, 2020, at 11:55 AM, akater <nuclearspace@gmail.com> 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


      reply	other threads:[~2020-05-01 18:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-30 18:55 Self-sufficient Org file with customised export? :eval-when? akater
2020-05-01 18:14 ` Berry, Charles via General discussions about Org-mode. [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B4B54324-5796-4A05-B039-36E24274E403@ucsd.edu \
    --to=emacs-orgmode@gnu.org \
    --cc=ccberry@health.ucsd.edu \
    --cc=nuclearspace@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).