From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Baier Subject: Re: How to initiate source edits Date: Tue, 07 May 2013 10:22:58 +0200 Message-ID: <87a9o7xkpp.fsf@gmail.com> References: <51835119.9000805@easy-emacs.de> <8738u4zck6.fsf@gmail.com> <51837FD0.6000808@easy-emacs.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([208.118.235.92]:38763) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZdAj-0000R9-4k for emacs-orgmode@gnu.org; Tue, 07 May 2013 04:22:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZdAh-0003X1-EL for emacs-orgmode@gnu.org; Tue, 07 May 2013 04:22:53 -0400 Received: from plane.gmane.org ([80.91.229.3]:57682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZdAh-0003Wn-8V for emacs-orgmode@gnu.org; Tue, 07 May 2013 04:22:51 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UZdAf-0005Hx-5a for emacs-orgmode@gnu.org; Tue, 07 May 2013 10:22:49 +0200 Received: from nat-wh-wh36.rz.uni-karlsruhe.de ([141.70.81.154]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 07 May 2013 10:22:49 +0200 Received: from lexi.baier by nat-wh-wh36.rz.uni-karlsruhe.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 07 May 2013 10:22:49 +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: emacs-orgmode@gnu.org Hi Andreas, Andreas Röhler writes: > Am 03.05.2013 10:34, schrieb Myles English: >> >> Hi Andreas, >> >> Andreas Röhler writes: >> >>> Hi, >>> >>> have in some source file, let's assume Python, the following: >>> >>> >>> foo = { >>> "bar": ( >>> "baz", >>> "qux", >>> ), >>> } >>> >>> What is the best way to put this into an >>> >>> #+BEGIN_SRC python >>> >>> foo = { >>> "bar": ( >>> "baz", >>> "qux", >>> ), >>> } >>> >>> #+END_SRC >> >> A literal answer would be: >> >> echo "#+BEGIN_SRC python\n" > newfile.org >> cat somefile.py >> newfile.org >> echo "\n#+END_SRC\n" >> newfile.org >> >> Myles >> > > ahh, that's great too :) > > BTW think it should exist a way to transform a region accordingly. Will open a separate thread maybe. > > Andreas You might want to take a look at Yasnippet, which in fact can transform a region into a source code block, as you describe it. Have a look at the User Guide[1] for writing snippets. Regards, Alex ___ [1] http://capitaomorte.github.io/yasnippet/snippet-development.html#yas-wrap-around-region