emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] order of evaluation upon export: macros are evaluated too soon


From: Charles C. Berry
Subject: Re: [O] order of evaluation upon export: macros are evaluated too soon
Date: Wed, 7 Jun 2017 11:43:02 -0700
User-agent: Alpine 2.20 (OSX 67 2015-01-07)

On Wed, 7 Jun 2017, Eric S Fraga wrote:

Hello all,

I have a document with this (ECM) structure:

#+begin_src org
 ,#+macro: item I{{{n(i)}}}@@latex:}%@@
 ,#+options: toc:nil num:nil

 ,* {{{item()}}} Some topic
 ,* {{{item()}}} Another topic                                  :noexport:
 ,* {{{item()}}} A final one
#+end_src

I would like the exported headings to be numbered Q1, Q2, ... but only
the exported ones.


Maybe implement somethng like this:


#+BEGIN_SRC emacs-lisp
  (defun n-noexport (x y)
    (let ((tags (nth 5 (org-heading-components))))
      (unless (and tags
                   (string-match ":noexport:" tags))
        (org-macro--counter-increment x y))))
#+END_SRC

#+MACRO: n2 (eval (n-noexport "$1" "$2"))


* heading 1

{{{n2()}}}


* heading 2                                                :noexport:notever:

{{{n2()}}}

* heading 3
{{{n2()}}}


HTH,

Chuck



reply via email to

[Prev in Thread] Current Thread [Next in Thread]