From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: how to insert a source template Date: Tue, 12 Apr 2011 01:04:22 -0600 Message-ID: <874o64uf0p.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:46656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9XeH-0006ZT-Sm for emacs-orgmode@gnu.org; Tue, 12 Apr 2011 03:04:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q9XeG-00057y-Sc for emacs-orgmode@gnu.org; Tue, 12 Apr 2011 03:04:29 -0400 Received: from mail-pz0-f41.google.com ([209.85.210.41]:48777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q9XeG-00057u-OJ for emacs-orgmode@gnu.org; Tue, 12 Apr 2011 03:04:28 -0400 Received: by pzk32 with SMTP id 32so3061537pzk.0 for ; Tue, 12 Apr 2011 00:04:27 -0700 (PDT) In-Reply-To: (Piter's message of "Tue, 12 Apr 2011 03:16:24 +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: Piter_ Cc: emacs-orgmode@gnu.org 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 (defun org-insert-block (lang) (interactive "Mlanguage: ") (insert (format "#+begin_src %s\n \n#+end_src" lang)) (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] http://orgmode.org/worg/org-faq.html#YASnippet -- Eric Schulte http://cs.unm.edu/~eschulte/