Re: [O] Defining macros globally

2016-12-20 Thread Arun Isaac

> I added `org-export-global-macros' in master. It's Christmas, after all.

Thanks! And, Merry Christmas! :-)


signature.asc
Description: PGP signature


Re: [O] Defining macros globally

2016-12-19 Thread Nicolas Goaziou
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



Re: [O] Defining macros globally

2016-12-19 Thread Charles C. Berry

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



Re: [O] Defining macros globally

2016-12-19 Thread Kaushal Modi
On Mon, Dec 19, 2016, 7:12 PM Arun Isaac  wrote:

>
> 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?
>

You can choose to put all macros in a single org file, and then add that
one file as a #+SETUPFILE in all the org files where you wish to use those
macros.

> --

Kaushal Modi


Re: [O] Defining macros globally

2016-12-19 Thread Nicolas Goaziou
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.

Regards,

-- 
Nicolas Goaziou



[O] Defining macros globally

2016-12-19 Thread Arun Isaac

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?

Thanks,
Arun Isaac.


signature.asc
Description: PGP signature