From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nicolas Goaziou Subject: Re: Defining macros globally Date: Mon, 19 Dec 2016 23:04:14 +0100 Message-ID: <8760mf1spt.fsf@nicolasgoaziou.fr> References: <87r3540xbn.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:44899) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJ62W-0005vF-9x for emacs-orgmode@gnu.org; Mon, 19 Dec 2016 17:04:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cJ62V-0001KU-9T for emacs-orgmode@gnu.org; Mon, 19 Dec 2016 17:04:12 -0500 Received: from relay4-d.mail.gandi.net ([2001:4b98:c:538::196]:45214) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cJ62V-0001JR-37 for emacs-orgmode@gnu.org; Mon, 19 Dec 2016 17:04:11 -0500 In-Reply-To: (Charles C. Berry's message of "Mon, 19 Dec 2016 10:41:31 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: "Charles C. Berry" Cc: Arun Isaac , "emacs-orgmode@gnu.org" Hello, "Charles C. Berry" writes: > On Mon, 19 Dec 2016, Nicolas Goaziou wrote: > >> Hello, >> >> Arun Isaac 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