I use Emacs for writing, not for coding. Is there an easy way, in Emacs or Emacs org-mode, to define a text string as a variable so that I can use it repeatedly?
Example: I created a template invoice.org
. It would be cool to put a variable like $CLIENTNAME
in the headers, in the table, on the cover page, in #+TITLE:
, and in the thank you, use that as a template, and then quickly generate a new PDF for each new client by just adding a line at the beginning like let $CLIENTNAME="Jane Doe"
.
How do I do this?
Best Answer
You want to use Macros (see the manual)
You can define them by using
and then call them by inserting
{{{clientname}}}
in the document where desired.On export
{{{clientname}}}
will expand toJane Doe
.