emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: akater <nuclearspace@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Self-sufficient Org file with customised export? :eval-when?
Date: Thu, 30 Apr 2020 18:55:17 +0000	[thread overview]
Message-ID: <87imhgyfai.fsf@gmail.com> (raw)

I'd like to write an Org file that would export to a html with fairly
significant tweaks along the way.  The rough idea is, users should be
able to run reasonaly recent vanilla emacs, (require 'ox),
(org-html-export-to-html) and get a fine-tuned html.

I also would like to move relevant Elisp to the end of the Org file
because the text is going to be read by humans, and people with(out)
certain background apparently faint too often when they see Lisp on top
of a text written in markup.

I put an emacs-lisp src block under the last unexported section, with
header arguments :exports none :results none, but it does not seem to be
evaluated on export.  I couldn't find anything relevant in Info directory.

I know that with vanilla emacs one needs to explicitly allow evaluation
of blocks but that can be considred an acceptable preamble.

It would also be great if exporting such a file would not alter the
state of Emacs session too much (wouldn't pollute hooks or add advices,
for example) but that's low priority.  For now, I just want a
self-contained customisation with minimal hassle for users to get the
export result that was intended.  What are my options?


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

#+begin_src emacs-lisp :eval-when tangle

#+begin_src emacs-lisp :eval-when export

#+begin_src emacs-lisp :eval-when ()

where the last setting would be equivalent to the (now-supported)
:eval never.

In my case, I'd write a block with header arguments

:eval-when export :results none

if this feature was supported.

I'm currently working on a Common Lisp-specific feature that will
introduce :eval-when (it will be offered to a Common Lisp library
literate-lisp) so I'm interested in opinions on this as well.

             reply	other threads:[~2020-04-30 19:12 UTC|newest]

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

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:

  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=87imhgyfai.fsf@gmail.com \
    --to=nuclearspace@gmail.com \
    --cc=emacs-orgmode@gnu.org \


* 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


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).