emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Fabrice Niessen" <fni-news-TA4HMoP+1wHrZ44/DZwexQ@public.gmane.org>
To: Nicolas Goaziou <n.goaziou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Bastien <bzg-mXXj517/zsQ@public.gmane.org>,
	public-emacs-orgmode-mXXj517/zsQ-wOFGN7rlS/M9smdsby/KFg@public.gmane.org
Subject: Re: [PATCH] `org-macro--collect-macros' can collect macro definitions from include files
Date: Wed, 05 Feb 2014 21:11:37 +0100	[thread overview]
Message-ID: <8638jx48w6.fsf@somewhere.org> (raw)
In-Reply-To: <8738jx34p1.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> (Nicolas Goaziou's message of "Wed, 05 Feb 2014 17:27:38 +0100")



Hello,

Nicolas Goaziou wrote:
> Bastien <bzg-mXXj517/zsQ@public.gmane.org> 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:

  ╭────
  │ #+name: version-history
  │ #+begin_src sh :exports none :results silent :colnames '(Version Date Author Comment)
  │ git log --pretty=format:"%h%x09%ad%x09%an%x09%s" --date=short | head -n 5
  │ #+end_src
  │
  │ #+MACRO: version-history call_version-history[:eval yes]()[:eval yes :results table :colnames '(Version Date Author Comment)]
  ╰────

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

-- 
Fabrice Niessen
Leuven, Belgium
http://www.pirilampo.org/

      parent reply	other threads:[~2014-02-05 20:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-05 16:09 [PATCH] `org-macro--collect-macros' can collect macro definitions from include files Fabrice Niessen
2014-02-05 16:17 ` Bastien
2014-02-05 16:27   ` Nicolas Goaziou
     [not found]     ` <8738jx34p1.fsf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-02-05 20:11       ` Fabrice Niessen [this message]

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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  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=8638jx48w6.fsf@somewhere.org \
    --to=fni-news-ta4hmop+1whrz44/dzwexq@public.gmane.org \
    --cc=bzg-mXXj517/zsQ@public.gmane.org \
    --cc=n.goaziou-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=public-emacs-orgmode-mXXj517/zsQ-wOFGN7rlS/M9smdsby/KFg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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