From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: Defining macros globally Date: Mon, 19 Dec 2016 10:41:31 -0800 Message-ID: References: <87r3540xbn.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cJ2sV-0000PK-NU for emacs-orgmode@gnu.org; Mon, 19 Dec 2016 13:41:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cJ2sS-0005CY-LD for emacs-orgmode@gnu.org; Mon, 19 Dec 2016 13:41:39 -0500 Received: from iport-bcv1-out.ucsd.edu ([132.239.0.119]:43976) by eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71) (envelope-from ) id 1cJ2sS-0005Bs-8O for emacs-orgmode@gnu.org; Mon, 19 Dec 2016 13:41:36 -0500 In-Reply-To: <87r3540xbn.fsf@nicolasgoaziou.fr> 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: Nicolas Goaziou Cc: Arun Isaac , "emacs-orgmode@gnu.org" 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. HTH, Chuck