* Adding Easy Templates @ 2012-05-23 13:10 Daniel E. Doherty 2012-05-23 13:28 ` Carsten Dominik 2012-05-23 13:29 ` Nick Dokos 0 siblings, 2 replies; 5+ messages in thread From: Daniel E. Doherty @ 2012-05-23 13:10 UTC (permalink / raw) To: Org-mode List All, I really like the Easy Template facility, and would like to add some of my own. However, I am having trouble with the elisp syntax. I would like to add a couple in my init file, but am having no luck. Here is what I have now: ========================= (eval-after-load 'org (progn (add-to-list 'org-structure-template-alist (list '("m" "#+begin_src emacs-lisp\n?\n#+end_src"))) (add-to-list 'org-structure-template-alist (list '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote"))))) ========================= Which yeilds: ========================= Debugger entered--Lisp error: (invalid-function (("j" "#+begin_quote ||Dr|Cr| |- |?|$|| |||$| #+end_quote"))) ========================= I have also tried this: ========================= (eval-after-load 'org (progn (add-to-list 'org-structure-template-alist '("m" "#+begin_src emacs-lisp\n?\n#+end_src")) (add-to-list 'org-structure-template-alist '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote")))) ========================= Which spits out a similar error. I am quoting the list, so I don't understand why elisp is interpteting it as a function. In the first case, I even quote it twice. Any help? Thanks. Dan Doherty ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding Easy Templates 2012-05-23 13:10 Adding Easy Templates Daniel E. Doherty @ 2012-05-23 13:28 ` Carsten Dominik 2012-05-23 13:35 ` Carsten Dominik 2012-05-23 13:29 ` Nick Dokos 1 sibling, 1 reply; 5+ messages in thread From: Carsten Dominik @ 2012-05-23 13:28 UTC (permalink / raw) To: Daniel E. Doherty; +Cc: Org-mode List Hi Daniel, you need to quote the entire form, i.e. the progn; (eval-after-load 'org '(progn (add-to-list 'org-structure-template-alist '("m" "#+begin_src emacs-lisp\n?\n#+end_src")) (add-to-list 'org-structure-template-alist '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote")))) This is because the entire form is stored for execution after loading org - but in your case it was evaluated immediately... - Carsten On May 23, 2012, at 3:10 PM, Daniel E. Doherty wrote: > All, > > I really like the Easy Template facility, and would like to add some of > my own. However, I am having trouble with the elisp syntax. I would > like to add a couple in my init file, but am having no luck. Here is > what I have now: > ========================= > (eval-after-load 'org > (progn > (add-to-list 'org-structure-template-alist > (list '("m" "#+begin_src emacs-lisp\n?\n#+end_src"))) > (add-to-list 'org-structure-template-alist > (list '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote"))))) > ========================= > Which yeilds: > ========================= > Debugger entered--Lisp error: (invalid-function (("j" "#+begin_quote > ||Dr|Cr| > |- > |?|$|| > |||$| > #+end_quote"))) > ========================= > > > I have also tried this: > ========================= > (eval-after-load 'org > (progn > (add-to-list 'org-structure-template-alist > '("m" "#+begin_src emacs-lisp\n?\n#+end_src")) > (add-to-list 'org-structure-template-alist > '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote")))) > ========================= > Which spits out a similar error. I am quoting the list, so I don't > understand why elisp is interpteting it as a function. In the first > case, I even quote it twice. > > Any help? > > Thanks. > > Dan Doherty > - Carsten ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding Easy Templates 2012-05-23 13:28 ` Carsten Dominik @ 2012-05-23 13:35 ` Carsten Dominik 2012-05-23 16:27 ` Daniel E. Doherty 0 siblings, 1 reply; 5+ messages in thread From: Carsten Dominik @ 2012-05-23 13:35 UTC (permalink / raw) To: Carsten Dominik; +Cc: Daniel E. Doherty, Org-mode List On May 23, 2012, at 3:28 PM, Carsten Dominik wrote: > Hi Daniel, > > you need to quote the entire form, i.e. the progn; > > (eval-after-load 'org > '(progn > (add-to-list 'org-structure-template-alist > '("m" "#+begin_src emacs-lisp\n?\n#+end_src")) > (add-to-list 'org-structure-template-alist > '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote")))) > > This is because the entire form is stored for execution after loading org - but in your case it was > evaluated immediately... .... so what happens is that the result of the second add-to-list command (that result is the extended list) is stored and then evaluated after org.el is loaded. So at that point in time, Emacs tries to evaluate (("j" ...... Which is of cause not valid because the first element in that list `("j" ...' is not a function. - Carsten > > - Carsten > > On May 23, 2012, at 3:10 PM, Daniel E. Doherty wrote: > >> All, >> >> I really like the Easy Template facility, and would like to add some of >> my own. However, I am having trouble with the elisp syntax. I would >> like to add a couple in my init file, but am having no luck. Here is >> what I have now: >> ========================= >> (eval-after-load 'org >> (progn >> (add-to-list 'org-structure-template-alist >> (list '("m" "#+begin_src emacs-lisp\n?\n#+end_src"))) >> (add-to-list 'org-structure-template-alist >> (list '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote"))))) >> ========================= >> Which yeilds: >> ========================= >> Debugger entered--Lisp error: (invalid-function (("j" "#+begin_quote >> ||Dr|Cr| >> |- >> |?|$|| >> |||$| >> #+end_quote"))) >> ========================= >> >> >> I have also tried this: >> ========================= >> (eval-after-load 'org >> (progn >> (add-to-list 'org-structure-template-alist >> '("m" "#+begin_src emacs-lisp\n?\n#+end_src")) >> (add-to-list 'org-structure-template-alist >> '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote")))) >> ========================= >> Which spits out a similar error. I am quoting the list, so I don't >> understand why elisp is interpteting it as a function. In the first >> case, I even quote it twice. >> >> Any help? >> >> Thanks. >> >> Dan Doherty >> > > - Carsten > > > - Carsten ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding Easy Templates 2012-05-23 13:35 ` Carsten Dominik @ 2012-05-23 16:27 ` Daniel E. Doherty 0 siblings, 0 replies; 5+ messages in thread From: Daniel E. Doherty @ 2012-05-23 16:27 UTC (permalink / raw) To: Org-mode List Gentlemen: For the record, I combined Carsten and Nick's suggestion, so here is what I now have in my init file, and it works: #+begin_src emacs-lisp (eval-after-load 'org '(progn (add-to-list 'org-structure-template-alist '("m" "#+begin_src emacs-lisp\n?\n#+end_src" "")) (add-to-list 'org-structure-template-alist '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote" "")))) #+end_src Carsten, I appreciate the explanation for why my quoting didn't work. I will now be adding many more of these Easy Templates to my init file, they are a great shortcut. Regards, At Wed, 23 May 2012 15:35:23 +0200, Carsten Dominik <carsten.dominik@gmail.com> wrote: > > > On May 23, 2012, at 3:28 PM, Carsten Dominik wrote: > > > Hi Daniel, > > > > you need to quote the entire form, i.e. the progn; > > > > (eval-after-load 'org > > '(progn > > (add-to-list 'org-structure-template-alist > > '("m" "#+begin_src emacs-lisp\n?\n#+end_src")) > > (add-to-list 'org-structure-template-alist > > '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote")))) > > > > This is because the entire form is stored for execution after loading org - but in your case it was > > evaluated immediately... > > .... > > so what happens is that the result of the second add-to-list command (that result is the extended list) is stored and then evaluated after org.el is loaded. So at that point in time, Emacs tries to evaluate > > > (("j" ...... > > Which is of cause not valid because the first element in that list `("j" ...' is not a function. > > - Carsten > > > > > > - Carsten > > > > On May 23, 2012, at 3:10 PM, Daniel E. Doherty wrote: > > > >> All, > >> > >> I really like the Easy Template facility, and would like to add some of > >> my own. However, I am having trouble with the elisp syntax. I would > >> like to add a couple in my init file, but am having no luck. Here is > >> what I have now: > >> ========================= > >> (eval-after-load 'org > >> (progn > >> (add-to-list 'org-structure-template-alist > >> (list '("m" "#+begin_src emacs-lisp\n?\n#+end_src"))) > >> (add-to-list 'org-structure-template-alist > >> (list '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote"))))) > >> ========================= > >> Which yeilds: > >> ========================= > >> Debugger entered--Lisp error: (invalid-function (("j" "#+begin_quote > >> ||Dr|Cr| > >> |- > >> |?|$|| > >> |||$| > >> #+end_quote"))) > >> ========================= > >> > >> > >> I have also tried this: > >> ========================= > >> (eval-after-load 'org > >> (progn > >> (add-to-list 'org-structure-template-alist > >> '("m" "#+begin_src emacs-lisp\n?\n#+end_src")) > >> (add-to-list 'org-structure-template-alist > >> '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote")))) > >> ========================= > >> Which spits out a similar error. I am quoting the list, so I don't > >> understand why elisp is interpteting it as a function. In the first > >> case, I even quote it twice. > >> > >> Any help? > >> > >> Thanks. > >> > >> Dan Doherty > >> > > > > - Carsten > > > > > > > > - Carsten > > > > ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Adding Easy Templates 2012-05-23 13:10 Adding Easy Templates Daniel E. Doherty 2012-05-23 13:28 ` Carsten Dominik @ 2012-05-23 13:29 ` Nick Dokos 1 sibling, 0 replies; 5+ messages in thread From: Nick Dokos @ 2012-05-23 13:29 UTC (permalink / raw) To: Daniel E. Doherty; +Cc: Org-mode List Daniel E. Doherty <ded-law@ddoherty.net> wrote: > I have also tried this: > ========================= > (eval-after-load 'org > (progn > (add-to-list 'org-structure-template-alist > '("m" "#+begin_src emacs-lisp\n?\n#+end_src")) > (add-to-list 'org-structure-template-alist > '("j" "#+begin_quote\n||Dr|Cr|\n|-\n|?|$||\n|||$|\n#+end_quote")))) > ========================= > Which spits out a similar error. I am quoting the list, so I don't > understand why elisp is interpteting it as a function. In the first > case, I even quote it twice. > I presume that it spits out the error when you try to *use* the template, correct? You can add anything you want to org-structure-template-alist, but if you try to *use* the thing, it'd better have the correct format. In any case, the above (without the call to ``list'') is the correct form, but the elements to add are *three*-element lists: (<key> <standard text> <muse text>). If you don't care about org-mtags (see the doc for org-structure-template-alist), just add an empty string as the third element. Untried but hope it works, Nick ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-05-23 16:28 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-05-23 13:10 Adding Easy Templates Daniel E. Doherty 2012-05-23 13:28 ` Carsten Dominik 2012-05-23 13:35 ` Carsten Dominik 2012-05-23 16:27 ` Daniel E. Doherty 2012-05-23 13:29 ` Nick Dokos
Code repositories for project(s) associated with this public inbox https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).