From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: [Babel] Macro for begin_src? Date: Sun, 18 Apr 2010 21:25:45 +0100 Message-ID: <87tyr8y0c6.wl%ucecesf@ucl.ac.uk> References: <4BC91BA7.6050904@ccbr.umn.edu> <87eiieuilx.fsf@fastmail.fm> <877ho5jb5g.wl%ucecesf@ucl.ac.uk> <87r5mcu2l7.fsf@stats.ox.ac.uk> <87tyr8r02g.fsf@gmail.com> Reply-To: Eric S Fraga Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O3b42-0006o7-DX for emacs-orgmode@gnu.org; Sun, 18 Apr 2010 16:25:58 -0400 Received: from [140.186.70.92] (port=51271 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O3b41-0006nc-54 for emacs-orgmode@gnu.org; Sun, 18 Apr 2010 16:25:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O3b3z-00033e-IP for emacs-orgmode@gnu.org; Sun, 18 Apr 2010 16:25:57 -0400 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:48181) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O3b3y-00032s-Ka for emacs-orgmode@gnu.org; Sun, 18 Apr 2010 16:25:55 -0400 Received: from 79-73-73-7.dynamic.dsl.as9105.com ([79.73.73.7] helo=esf.ucl.ac.uk) by vscane-b.ucl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.60) (envelope-from ) id 1O3b3u-0005nu-L0 for emacs-orgmode@gnu.org; Sun, 18 Apr 2010 21:25:51 +0100 In-Reply-To: <87tyr8r02g.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org On Sun, 18 Apr 2010 22:13:27 +0200, =C5=A0t=C4=9Bp=C3=A1n N=C4=9Bmec wrote: >=20 > Dan Davison writes: > > I guess, for Nate's original application (converting existing code to > > src blocks), what might have been most useful is something to enclose a > > given region in a source block. Can anyone show how to do that with > > yasnippet (or anything else)? >=20 > I don't have a ready-to-use snippet, but this is what you need: >=20 > http://yasnippet.googlecode.com/svn/trunk/doc/snippet-development.html#ya= s-wrap-around-region >=20 >=20 > HTH, >=20 > =C5=A0t=C4=9Bp=C3=A1n and you can also insert the value of yas/selected-text directly into the snippet anywhere you want. e.g. --8<---------------cut here---------------start------------->8--- #name : testing yasnippets for org-mode # -- #+BEGIN_LaTeX `yas/selected-text` $0 #+END_LaTeX --8<---------------cut here---------------end--------------->8--- of course, you can only do this (or the wrap around region approach) if you invoke the snippet directly using a key binding (e.g. the default "C-c & C-s" or "M-x yas/insert-snippet") as opposed to tab expansion on the snippet name (which is more convenient). Note that you can assign key bindings directly to snippets.