From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Macros [was: Re: ATTR_HTML for a clickable image, howto?] Date: Sun, 20 May 2012 10:02:05 +0200 Message-ID: <87txzbcmbm.fsf@gmail.com> References: <86pqbrywgr.fsf@iro.umontreal.ca> <87r4w63602.fsf@gnu.org> <86vclekyqo.fsf@iro.umontreal.ca> <4F7EAED9.2040804@christianmoe.com> <4F803DDC.20808@christianmoe.com> <4F853CCD.4020601@christianmoe.com> <86r4ufr7hx.fsf_-_@mercure.progiciels-bpi.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57253) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SW18T-0007jz-Vg for emacs-orgmode@gnu.org; Sun, 20 May 2012 04:05:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SW18S-000555-69 for emacs-orgmode@gnu.org; Sun, 20 May 2012 04:05:05 -0400 Received: from mail-we0-f169.google.com ([74.125.82.169]:51753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SW18R-00053H-TK for emacs-orgmode@gnu.org; Sun, 20 May 2012 04:05:04 -0400 Received: by wefh52 with SMTP id h52so3374273wef.0 for ; Sun, 20 May 2012 01:05:01 -0700 (PDT) In-Reply-To: <86r4ufr7hx.fsf_-_@mercure.progiciels-bpi.ca> (=?utf-8?Q?=22F?= =?utf-8?Q?ran=C3=A7ois?= Pinard"'s message of "Sat, 19 May 2012 21:00:58 -0400") 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: =?utf-8?Q?Fran=C3=A7ois?= Pinard Cc: emacs-orgmode@gnu.org Hello, Fran=C3=A7ois Pinard writes: > The examples in the manual do not hint either about whether newlines > are allowed or not in macro arguments. They are not. > In fact, the manual section "Macro replacement" says very little, so > when I initially read it, I guessed that macros are only usable in very > simple cases. However, the last statement says that macros can be used > to construct "complex HTML code". Yet, the definition method at the > beginning suggests that macro definitions have to fit on one line, and > this seriously limits the complexity of what we can do with them. So, > on initial reading, I just decided I understood nothing about > them :-). They can build complex code since you can eval a sexp in a macro: --8<---------------cut here---------------start------------->8--- #+TITLE: Macro test #+MACRO: test2 recursive $1 #+MACRO: test A {{{test2(inner)}}} macro, $1. #+MACRO: html-builder (eval (+ $1 $2)) {{{test(and an outer one)}}} Some complex macro {{{html-builder(1,2)}}}. --8<---------------cut here---------------end--------------->8--- > If macros are there to stay in Org, it might be worth documenting a more > complete specification about how to define and use them. They are useful. Though, for "complex code", I think Babel should be the way to go. Regards, --=20 Nicolas Goaziou