[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Defining macros globally
From: |
Nicolas Goaziou |
Subject: |
Re: [O] Defining macros globally |
Date: |
Mon, 19 Dec 2016 23:04:14 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Hello,
"Charles C. Berry" <address@hidden> writes:
> On Mon, 19 Dec 2016, Nicolas Goaziou wrote:
>
>> Hello,
>>
>> Arun Isaac <address@hidden> 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.
I added `org-export-global-macros' in master. It's Christmas, after all.
Regards,
--
Nicolas Goaziou