From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Fabrice Niessen" Subject: Re: [PATCH] `org-macro--collect-macros' can collect macro definitions from include files Date: Wed, 05 Feb 2014 21:11:37 +0100 Message-ID: <8638jx48w6.fsf@somewhere.org> References: <86ob2la6e6.fsf@somewhere.org> <87d2j1y1mw.fsf@bzg.ath.cx> <8738jx34p1.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <8738jx34p1.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> (Nicolas Goaziou's message of "Wed, 05 Feb 2014 17:27:38 +0100") 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-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: Nicolas Goaziou Cc: Bastien , public-emacs-orgmode-mXXj517/zsQ-wOFGN7rlS/M9smdsby/KFg@public.gmane.org Hello, Nicolas Goaziou wrote: > Bastien writes: >> "Fabrice Niessen" writes: >> >>> As the DOCSTRING of the function `org-macro--collect-macros' tells it, >>> it "collects macro definitions in current buffer and setup files", not >>> from INCLUDE files. >> >> Then your patch should change the docstring too. Right! >> I think we want to collect macros from setupfile only, >> that's one of the differences between INCLUDE and SETUPFILE. > > I agree. > > Not all "Include" files are Org files. OK, but that shouldn't be a problem either: if there is no #+MACRO in an "Include" file, that doesn't matter... > Moreover, "INCLUDE" keywords are expanded before initializing macro > templates during export, so "MACRO" keywords should be read when > appropriate. You say that the order of operations, during export, is: - Include files through "INCLUDE" keywords - Expand macros OK. Still, I don't understand what you mean by "so MACRO keywords should be read when appropriate"? Anyway, let me explain what I wish such a feature (_or_ the opposite: that Babel blocks are allowed in SETUPFILE)... I'm sharing on GitHub a project [1] where I write Org macros that everybody could once need, and these are easily accessible (once cloned) in every file, after a simple directive such as: #+INCLUDE: /path/to/org-macros.setup As I do have Babel code blocks inside the `org-macros.setup' file, it needs to be loaded via the "INCLUDE" directive, not via a "SETUPFILE". Example of such macro calling a Babel code block: =E2=95=AD=E2=94=80=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 #+name: version-history =E2=94=82 #+begin_src sh :exports none :results silent :colnames '(Versio= n Date Author Comment) =E2=94=82 git log --pretty=3Dformat:"%h%x09%ad%x09%an%x09%s" --date=3Dsho= rt | head -n 5 =E2=94=82 #+end_src =E2=94=82 =E2=94=82 #+MACRO: version-history call_version-history[:eval yes]()[:eva= l yes :results table :colnames '(Version Date Author Comment)] =E2=95=B0=E2=94=80=E2=94=80=E2=94=80=E2=94=80 So, thanks to the INCLUDE directive, I already have a one-liner to include such "extended macros". But these aren't collected by `org-macro--collect-macros'... Best regards, Fabrice [1] https://github.com/fniessen/org-macros --=20 Fabrice Niessen Leuven, Belgium http://www.pirilampo.org/