On Mon, 19 Dec 2016, Nicolas Goaziou wrote:

Hello,

Arun Isaac <arunis...@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

Reply via email to