emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: emacs-orgmode@gnu.org
Subject: Re: How to initiate source edits
Date: Tue, 07 May 2013 12:55:45 +0200	[thread overview]
Message-ID: <5188DDB1.4020003@easy-emacs.de> (raw)
In-Reply-To: <87a9o7xkpp.fsf@gmail.com>

Hi Alexander,

Am 07.05.2013 10:22, schrieb Alexander Baier:
> Hi Andreas,
>
> Andreas Röhler <andreas.roehler@easy-emacs.de> 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	other threads:[~2013-05-07 10:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03  5:54 How to initiate source edits Andreas Röhler
2013-05-03  8:07 ` Achim Gratz
2013-05-03  8:27   ` Andreas Röhler
2013-05-03  8:34 ` Myles English
2013-05-03  9:13   ` Andreas Röhler
2013-05-07  8:22     ` Alexander Baier
2013-05-07 10:55       ` Andreas Röhler [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5188DDB1.4020003@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).