From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: Customizing "Easy Templates"? Date: Thu, 07 Jul 2011 09:30:37 +0100 Message-ID: <87fwmitrv6.fsf@ucl.ac.uk> References: <1310005724.44036.YahooMailRC@web161905.mail.bf1.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:50192) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qejz4-00062U-CY for emacs-orgmode@gnu.org; Thu, 07 Jul 2011 04:30:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qejz1-0008Uv-N7 for emacs-orgmode@gnu.org; Thu, 07 Jul 2011 04:30:53 -0400 Received: from vscane-c.ucl.ac.uk ([144.82.108.43]:54361) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qejz1-0008UJ-D2 for emacs-orgmode@gnu.org; Thu, 07 Jul 2011 04:30:51 -0400 In-Reply-To: (suvayu ali's message of "Thu, 7 Jul 2011 07:13:55 +0200") 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: suvayu ali Cc: Michael Hannon , Org-Mode List suvayu ali writes: > Hey Mike, > > On Thu, Jul 7, 2011 at 4:28 AM, Michael Hannon wrot= e: >> I can't figure out how to >> customize the text of these templates. =C2=A0Can anybody point me in the= right >> direction? >> > > This should work: > > (add-to-list 'org-structure-template-alist > '("S" "#+BEGIN_SRC ?\n\n#+END_SRC" "\n\n")) Mike, if you intend to customise further than this, you might wish to consider using yasnippets [1] instead of these templates, although these templates are indeed quite useful! I use both but, for instance, for source blocks, I have the following snippet defined: --8<---------------cut here---------------start------------->8--- #name : #+begin_src language options ...#+end_src # -- #+srcname: $1 #+begin_src $2 $3 $0 #+end_src --8<---------------cut here---------------end--------------->8--- so that typing "src TAB" starts defining a source block with subsequent TABs allowing me to fill in the name, the language, the arguments and finally puts me into the actual code section. The nice thing about yasnippets is that you can have defaults for any of the fields. For instance, here is one I use for Java files (not org): --8<---------------cut here---------------start------------->8--- #contributor: dobbymoodge #name : public? class ... { ... } # -- // Copyright (c) 2011, Eric S Fraga, All rights reserved. package ${1:jacaranda.design}; import jacaranda.base.Settings; ${2:public} class ${3:foo} ${4:extends jacaranda.base.EGO} { public static boolean debug =3D false; private static final int dl =3D 5; private static String version =3D "2011.03.02 20:04:40"; static { Settings.output.printf (": <%s> $3\n", version); } ${5:public} $3 () { $0 } } // end of $3 class // Local Variables: // time-stamp-line-limit: 1000 // time-stamp-format: "%04y-%02m-%02d %02H:%02M:%02S" // time-stamp-active: t // time-stamp-start: "version =3D \"" // time-stamp-end: "\";" // End: --8<---------------cut here---------------end--------------->8--- for when I start a new class file. Footnotes:=20 [1] http://www.emacswiki.org/emacs/Yasnippet --=20 : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.5 (release_7.5.586.g382e6)