emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Multi-line macros (again)


From: Rasmus
Subject: Re: [O] Multi-line macros (again)
Date: Wed, 12 Oct 2016 11:56:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Nicolas Goaziou <address@hidden> writes:

> Hello,
>
> Jarmo Hurri <address@hidden> writes:
>
>> One of the most useful properties of LaTeX is \newcommand, which allows
>> you to reuse document structures. I really, _really_ miss this feature
>> in Org. Org has #+MACRO, but it is limited to a single line. That is
>> very inconvenient for any larger structures.
>
> Of course, macro are inconvenient for complex structures. They are not
> the right tool for the job. You could use Babel for that, e.g.,
>
>   #+name: template
>   #+header: :var x="" y=""
>
>   #+header: :results silent
>   #+begin_src org
>
>   $x
>   $y
>   #+end_src
>
>   #+call: template("line 1", "line 2") :results replace
>
>   #+RESULTS:
>   line 1
>   line 2
>
>> Could we have multiline macros, something like
>>
>> #+BEGIN_MACRO name
>> #+END_MACRO
>
> For the record, I think that block syntax is largely overloaded. I'd
> rather not introduce a new type of block without a really good reason.
>
> Anyway, is there anything wrong with Babel, as suggested above?

To me, the syntax is a bit tiresome for inline calls,

     call_<name>[<inside header arguments>](<arguments>)[<end header arguments>]

You almost always have to tweak the header arguments to get it to work
properly.  E.g. I think it prints return values as code by default
(e.g. "=ยท=").

I wonder if we could allow remote editing of macros like with table
formulas.

Rasmus

-- 
Dung makes an excellent fertilizer




reply via email to

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