From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel E. Doherty Subject: Re: Adding Easy Templates Date: Wed, 23 May 2012 11:27:47 -0500 Message-ID: <87zk8yhngc.wl%ded-law@ddoherty.net> References: <87d35vxcuc.wl%ded-law@ddoherty.net> <688B6FE9-3E38-4159-8528-AE68B4E9FB14@gmail.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Return-path: Received: from eggs.gnu.org ([208.118.235.92]:57438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXEPm-0005iV-Tf for emacs-orgmode@gnu.org; Wed, 23 May 2012 12:28:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SXEPg-0003ZH-EN for emacs-orgmode@gnu.org; Wed, 23 May 2012 12:27:58 -0400 Received: from mail-vb0-f41.google.com ([209.85.212.41]:44552) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SXEPg-0003Yh-7Q for emacs-orgmode@gnu.org; Wed, 23 May 2012 12:27:52 -0400 Received: by vbbey12 with SMTP id ey12so6108022vbb.0 for ; Wed, 23 May 2012 09:27:50 -0700 (PDT) In-Reply-To: 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org 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 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 > > > >