emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Alexander Baier <lexi.baier@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: How to initiate source edits
Date: Tue, 07 May 2013 10:22:58 +0200	[thread overview]
Message-ID: <87a9o7xkpp.fsf@gmail.com> (raw)
In-Reply-To: 51837FD0.6000808@easy-emacs.de

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

  reply	other threads:[~2013-05-07  8:22 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 [this message]
2013-05-07 10:55       ` Andreas Röhler

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=87a9o7xkpp.fsf@gmail.com \
    --to=lexi.baier@gmail.com \
    --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).