From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rasmus Subject: Re: Multi-line macros (again) Date: Wed, 12 Oct 2016 11:56:31 +0200 Message-ID: <87k2ddq4a8.fsf@gmx.us> References: <87int49z1k.fsf@iki.fi> <87y41xkh77.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buGHX-0001u7-Ni for emacs-orgmode@gnu.org; Wed, 12 Oct 2016 05:57:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1buGHS-0001fH-Mf for emacs-orgmode@gnu.org; Wed, 12 Oct 2016 05:57:02 -0400 Received: from [195.159.176.226] (port=42937 helo=blaine.gmane.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1buGHS-0001eD-Fn for emacs-orgmode@gnu.org; Wed, 12 Oct 2016 05:56:58 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1buGH7-0002II-NF for emacs-orgmode@gnu.org; Wed, 12 Oct 2016 11:56:37 +0200 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: emacs-orgmode@gnu.org Nicolas Goaziou writes: > Hello, > > Jarmo Hurri 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_[]()[] 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