From: "Charles C. Berry" <ccberry@ucsd.edu>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: Arun Isaac <arunisaac@systemreboot.net>,
"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Re: Defining macros globally
Date: Mon, 19 Dec 2016 10:41:31 -0800 [thread overview]
Message-ID: <alpine.OSX.2.20.1612191035520.1032@charles-berrys-macbook.local> (raw)
In-Reply-To: <87r3540xbn.fsf@nicolasgoaziou.fr>
On Mon, 19 Dec 2016, Nicolas Goaziou wrote:
> Hello,
>
> Arun Isaac <arunisaac@systemreboot.net> writes:
>
>> Is it possible to define macros globally, probably in the ~/.emacs init
>> file with some elisp, instead of on a per-file basis using the #+MACRO
>> keyword?
>
> This is not possible ATM.
Perhaps the OP could do this?
#+BEGIN_SRC emacs-lisp
(setq my-new-macros
'(("def" . "d $1 e $2 f")
("ghi" . "GHI only")))
(defun add-my-macros (&rest x)
(nconc org-macro-templates my-new-macros))
(advice-add 'org-macro-initialize-templates :filter-return
#'add-my-macros)
#+END_SRC
Admittedly, this invites problems if `my-new-macros' is malformed. But
there could be ways to impose a discipline that would assure that it is
not.
HTH,
Chuck
next prev parent reply other threads:[~2016-12-19 18:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-19 13:40 Defining macros globally Arun Isaac
2016-12-19 15:10 ` Nicolas Goaziou
2016-12-19 18:41 ` Charles C. Berry [this message]
2016-12-19 22:04 ` Nicolas Goaziou
2016-12-20 10:00 ` Arun Isaac
2016-12-19 17:59 ` Kaushal Modi
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=alpine.OSX.2.20.1612191035520.1032@charles-berrys-macbook.local \
--to=ccberry@ucsd.edu \
--cc=arunisaac@systemreboot.net \
--cc=emacs-orgmode@gnu.org \
--cc=mail@nicolasgoaziou.fr \
/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).