emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] How to initiate source edits


From: Andreas Röhler
Subject: Re: [O] How to initiate source edits
Date: Tue, 07 May 2013 12:55:45 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Hi Alexander,

Am 07.05.2013 10:22, schrieb Alexander Baier:
Hi Andreas,

Andreas Röhler <address@hidden> 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





Thanks pointing at that great tool.
In the precise case the command looked for was mentioned at the separate thread:

org-babel-demarcate-block

Best,

Andreas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]