From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: order of evaluation upon export: macros are evaluated too soon Date: Wed, 7 Jun 2017 11:43:02 -0700 Message-ID: References: <874lvriyuv.fsf@delle7240.chemeng.ucl.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dIfvF-0005n1-9o for emacs-orgmode@gnu.org; Wed, 07 Jun 2017 14:43:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dIfvB-0000Th-DP for emacs-orgmode@gnu.org; Wed, 07 Jun 2017 14:43:13 -0400 Received: from iport-acv6-out.ucsd.edu ([132.239.0.13]:22020) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1dIfvB-0000Qg-0v for emacs-orgmode@gnu.org; Wed, 07 Jun 2017 14:43:09 -0400 In-Reply-To: <874lvriyuv.fsf@delle7240.chemeng.ucl.ac.uk> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Eric S Fraga Cc: emacs-orgmode@gnu.org 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