From mboxrd@z Thu Jan 1 00:00:00 1970 From: Piter_ Subject: Re: how to insert a source template Date: Tue, 12 Apr 2011 11:45:31 +0200 Message-ID: References: <874o64uf0p.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:42171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9aA9-0005aJ-Fq for emacs-orgmode@gnu.org; Tue, 12 Apr 2011 05:45:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9aA8-0006ZX-Ex for emacs-orgmode@gnu.org; Tue, 12 Apr 2011 05:45:33 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:57523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9aA8-0006ZC-A7 for emacs-orgmode@gnu.org; Tue, 12 Apr 2011 05:45:32 -0400 Received: by wyf19 with SMTP id 19so6550392wyf.0 for ; Tue, 12 Apr 2011 02:45:31 -0700 (PDT) In-Reply-To: <874o64uf0p.fsf@gmail.com> 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: emacs-orgmode@gnu.org Thanks guys. Exactly what I wanted. The word template had not came into my mind, thats why my googling was not sucesseful :( On Tue, Apr 12, 2011 at 9:04 AM, Eric Schulte wrot= e: > Hi Petro, > > You can use yasnippet to expand keywords into templates (like code > blocks) with TAB, see the following for instructions on using yasnippet > with Org-mode [1]. > > Alternately you could add the following elisp code to your config, and > bind the `org-insert-block' function to a comfortable key combination. > > #+begin_src emacs-lisp > =A0(defun org-insert-block (lang) > =A0 =A0(interactive "Mlanguage: ") > =A0 =A0(insert (format "#+begin_src %s\n =A0\n#+end_src" lang)) > =A0 =A0(goto-char (- (point) 10))) > #+end_src > > Cheers -- Eric > > Piter_ writes: > >> Hi all. >> I have no big knowlege of elisp. But I hope some one already done this. >> I want to make a key binding which would insert a source code template >> like this (I've got tired to type it every time): >> >> #+source: >> #+begin_src >> >> #+end_src >> >> Thanks. >> Petro. >> > > > Footnotes: > [1] =A0http://orgmode.org/worg/org-faq.html#YASnippet > > -- > Eric Schulte > http://cs.unm.edu/~eschulte/ >