I am using org-reveal for presentation

It has a #+BEGIN_NOTES for creating speaker notes

Tried to shorten with this macro n following this suggestion

 #+MACRO: n (eval "\n#+BEGIN_NOTES\n$1\n#+END_NOTES\n")

It works if I use {{{n(some notes)}}} in a single file

But if the file #+Include: some other file I get strange errors on export:

eval: Wrong number of arguments: eval, 5

This is org mode version 8.3beta

When I switched to 9.3.8 I got an eval error in the outside file itself

And org 9.4 doesnt load at all so I assumed its too bleeding edge and hurriedly went back

Yeah my emacs is a bit old: 24.5.1; can't afford an upgrade at this point

Added later in response to @NickD

I tried digging... And found that

org-export-expand-as doesn't seem to be used in org-reveal.

So I did the following

  • Moved the macro out from the org into lisp and removed the eval
(setq org-export-global-macros '(("n" . "\n#+BEGIN_NOTES\n$1\n#+END_NOTES\n")))
  • Ran
M-:  (org-export-expand-include-keyword)
M-:  (org-macro-replace-all org-export-global-macros)

After this reveal exporter works

Unfortunately my simplistic try at automating the above doesnt work

(defun mymacro-expand ()
  (let ((c (buffer-substring-no-properties (point-min) (point-max))))
    (with-temp-file "ttt.org"
      (insert c)
      (org-macro-replace-all org-export-global-macros))
  1. I guess I should file a org-reveal bug report

But if you can suggest an alternative to above using org-expand-as that'd be great!

Addition 2

Downloaded and compiled emacs

Now its at version 28.0.50
Org version 9.4

It now seems that the $1 inside the string breaks whereas the format version doesn't.

Error message is eval: Wrong number of arguments: eval, 4

Can you try with these two files?

$ cat foo.org 
#+TITLE: Some title
#+MACRO: n (eval "\n#+BEGIN_NOTES\n$1\n#+END_NOTES\n")
* Outside heading
#+Include: bar.org

$ cat bar.org
* Inside heading
Some text
{{{n(internal note)}}}
Some more text
  • It should be org-export-as. But is this still 8.3? That's too old to have it. Moveing to the latest version of org that works with your emacs is recommended, I think. – NickD Oct 14 '20 at 16:35
  • @NickD I don't see any org-export-as either : github.com/yjwen/org-reveal/blob/master/ox-reveal.el And yes, my digging around was all in 9.3.8 – Rusi Oct 14 '20 at 17:00
  • org-export-as is the Org mode function that gets called at the top level to export a file: it orchestrates the export by calling functions defined in each exporter (in a table-driven fashon) so you will find it as I pointed out indirectly in my comment (after my answer) in ox.el, not in any particular exporter. – NickD Oct 14 '20 at 17:03
  • According to the documentation: Within such templates, arguments become strings. So "\n#+BEGIN_NOTES\n$1\n#+END_NOTES\n" becomes "\n#+BEGIN_NOTES\n"internal note"\n#+END_NOTES\n". That is why only the format version works. – Hubisan Oct 15 '20 at 12:39

The following seems to work on fairly recent Org mode and Emacs: Org mode version 9.4 (release_9.4-3-ge6021b @ /home/nick/elisp/org-mode/lisp/) - GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.32, cairo version 1.16.0) of 2020-06-15).

  • foo.org:
#+MACRO: n (eval (format "\n#+BEGIN_NOTES\n%s\n#+END_NOTES\n" $1))

* Link


* foo

#+include: bar.org

  • bar.org:

Result of exporting foo.orgto LaTeX is:

% Created 2020-10-14 Wed 09:30
% Intended LaTeX compiler: pdflatex
\author{Nick Dokos}
 pdfauthor={Nick Dokos},
 pdfcreator={Emacs 28.0.50 (Org mode 9.4)}, 







Result of exporting it to HTML using the ox-reveal library from MELPA (only the <body>...</body> part of the file is shown to save some space):

<div class="reveal">
<div class="slides">
<section id="sec-title-slide"><h2 class="author">Nick Dokos</h2><p class="date">Created: 2020-10-14 Wed 13:08</p>
<section id="table-of-contents"><div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<li><a href="#/slide-org4e9fdef">1. Link</a></li>
<li><a href="#/slide-org464c226">2. foo</a></li>

<section id="slide-org4e9fdef">
<h2 id="org4e9fdef"><span class="section-number-2">1</span> Link</h2>
<a href="https://emacs.stackexchange.com/questions/61189/org-macros-misbehave-in-include-file">https://emacs.stackexchange.com/questions/61189/org-macros-misbehave-in-include-file</a>

<section id="slide-org464c226">
<h2 id="org464c226"><span class="section-number-2">2</span> foo</h2>
<aside class="notes">


<aside class="notes">

<script src="./reveal.js/js/reveal.js"></script>

// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
multiplex: {
    secret: '', // null if client
    id: '', // id, obtained from socket.io server
    url: '' // Location of socket.io server

// Optional libraries used to extend on reveal.js
dependencies: [
 { src: './reveal.js/lib/js/classList.js', condition: function() { return !document.body.classList; } },
 { src: './reveal.js/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
 { src: './reveal.js/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
 { src: './reveal.js/plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
 { src: './reveal.js/plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } }]
  • It seems a bug in org-reveal : include processing not proper – Rusi Oct 14 '20 at 14:12
  • The include processing is done by org-export-as, so it is generic (and so it the macro processing BTW : they are steps 1 and 3-4 in org-export-as so they are done before any specific exporter gets its hands on the text), so org-reveal would have to go to some lengths to screw it up. It would be worth digging down a bit I think. – NickD Oct 14 '20 at 14:28
  • Installed ox-reveal and exported the above file with it: no problems. – NickD Oct 14 '20 at 17:13
  • When I changed the macro to use format as you've done I get Symbol's function definition is void: seq-filter So I guess it comes down to an emacs version issue (I see seq-filter and seq-map in ox-reveal.el and undefined in my emacs) Do you by any chance know if they are in cl-lib and simple enough to copy out? – Rusi Oct 15 '20 at 2:32
  • New addition 2. Can you please check? (both reveal and latex exporters) – Rusi Oct 15 '20 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.