* Defining macros globally
@ 2016-12-19 13:40 Arun Isaac
2016-12-19 15:10 ` Nicolas Goaziou
2016-12-19 17:59 ` Kaushal Modi
0 siblings, 2 replies; 6+ messages in thread
From: Arun Isaac @ 2016-12-19 13:40 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 174 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Defining macros globally
2016-12-19 13:40 Defining macros globally Arun Isaac
@ 2016-12-19 15:10 ` Nicolas Goaziou
2016-12-19 18:41 ` Charles C. Berry
2016-12-19 17:59 ` Kaushal Modi
1 sibling, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-12-19 15:10 UTC (permalink / raw)
To: Arun Isaac; +Cc: emacs-orgmode@gnu.org
Hello,
Arun Isaac <arunisaac@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.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Defining macros globally
2016-12-19 13:40 Defining macros globally Arun Isaac
2016-12-19 15:10 ` Nicolas Goaziou
@ 2016-12-19 17:59 ` Kaushal Modi
1 sibling, 0 replies; 6+ messages in thread
From: Kaushal Modi @ 2016-12-19 17:59 UTC (permalink / raw)
To: Arun Isaac, emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 417 bytes --]
On Mon, Dec 19, 2016, 7:12 PM Arun Isaac <arunisaac@systemreboot.net> 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
[-- Attachment #2: Type: text/html, Size: 980 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Defining macros globally
2016-12-19 15:10 ` Nicolas Goaziou
@ 2016-12-19 18:41 ` Charles C. Berry
2016-12-19 22:04 ` Nicolas Goaziou
0 siblings, 1 reply; 6+ messages in thread
From: Charles C. Berry @ 2016-12-19 18:41 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Arun Isaac, emacs-orgmode@gnu.org
On Mon, 19 Dec 2016, Nicolas Goaziou wrote:
> Hello,
>
> Arun Isaac <arunisaac@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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Defining macros globally
2016-12-19 18:41 ` Charles C. Berry
@ 2016-12-19 22:04 ` Nicolas Goaziou
2016-12-20 10:00 ` Arun Isaac
0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-12-19 22:04 UTC (permalink / raw)
To: Charles C. Berry; +Cc: Arun Isaac, emacs-orgmode@gnu.org
Hello,
"Charles C. Berry" <ccberry@ucsd.edu> writes:
> On Mon, 19 Dec 2016, Nicolas Goaziou wrote:
>
>> Hello,
>>
>> Arun Isaac <arunisaac@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.
I added `org-export-global-macros' in master. It's Christmas, after all.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Defining macros globally
2016-12-19 22:04 ` Nicolas Goaziou
@ 2016-12-20 10:00 ` Arun Isaac
0 siblings, 0 replies; 6+ messages in thread
From: Arun Isaac @ 2016-12-20 10:00 UTC (permalink / raw)
To: emacs-orgmode@gnu.org
[-- Attachment #1: Type: text/plain, Size: 111 bytes --]
> I added `org-export-global-macros' in master. It's Christmas, after all.
Thanks! And, Merry Christmas! :-)
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 454 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-12-20 10:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-19 13:40 Defining macros globally Arun Isaac
2016-12-19 15:10 ` Nicolas Goaziou
2016-12-19 18:41 ` Charles C. Berry
2016-12-19 22:04 ` Nicolas Goaziou
2016-12-20 10:00 ` Arun Isaac
2016-12-19 17:59 ` Kaushal Modi
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.