emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Rasmus <rasmus@gmx.us>
To: emacs-orgmode@gnu.org
Subject: Re: Multi-line macros (again)
Date: Wed, 12 Oct 2016 11:56:31 +0200	[thread overview]
Message-ID: <87k2ddq4a8.fsf@gmx.us> (raw)
In-Reply-To: 87y41xkh77.fsf@nicolasgoaziou.fr

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Jarmo Hurri <jarmo.hurri@iki.fi> 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	other threads:[~2016-10-12  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 11:30 Multi-line macros (again) Jarmo Hurri
2016-10-09  9:25 ` Nicolas Goaziou
2016-10-12  9:56   ` Rasmus [this message]
2016-10-12 10:22     ` Nicolas Goaziou
2016-10-12 10:29       ` Rasmus

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=87k2ddq4a8.fsf@gmx.us \
    --to=rasmus@gmx.us \
    --cc=emacs-orgmode@gnu.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).