* How to initiate source edits
@ 2013-05-03 5:54 Andreas Röhler
2013-05-03 8:07 ` Achim Gratz
2013-05-03 8:34 ` Myles English
0 siblings, 2 replies; 7+ messages in thread
From: Andreas Röhler @ 2013-05-03 5:54 UTC (permalink / raw)
To: emacs-orgmode
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
Thanks,
Andreas
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to initiate source edits
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
1 sibling, 1 reply; 7+ messages in thread
From: Achim Gratz @ 2013-05-03 8:07 UTC (permalink / raw)
To: emacs-orgmode
Andreas Röhler <andreas.roehler <at> easy-emacs.de> writes:
> What is the best way to put this into an
>
> #+BEGIN_SRC python
>
> foo = {
> "bar": (
> "baz",
> "qux",
> ),
> }
>
> #+END_SRC
< s TAB python C-c ' C-x i src.python C-c '
Regards,
Achim.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to initiate source edits
2013-05-03 5:54 How to initiate source edits Andreas Röhler
2013-05-03 8:07 ` Achim Gratz
@ 2013-05-03 8:34 ` Myles English
2013-05-03 9:13 ` Andreas Röhler
1 sibling, 1 reply; 7+ messages in thread
From: Myles English @ 2013-05-03 8:34 UTC (permalink / raw)
To: Andreas Röhler; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to initiate source edits
2013-05-03 8:34 ` Myles English
@ 2013-05-03 9:13 ` Andreas Röhler
2013-05-07 8:22 ` Alexander Baier
0 siblings, 1 reply; 7+ messages in thread
From: Andreas Röhler @ 2013-05-03 9:13 UTC (permalink / raw)
To: Myles English; +Cc: emacs-orgmode
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to initiate source edits
2013-05-03 9:13 ` Andreas Röhler
@ 2013-05-07 8:22 ` Alexander Baier
2013-05-07 10:55 ` Andreas Röhler
0 siblings, 1 reply; 7+ messages in thread
From: Alexander Baier @ 2013-05-07 8:22 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: How to initiate source edits
2013-05-07 8:22 ` Alexander Baier
@ 2013-05-07 10:55 ` Andreas Röhler
0 siblings, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2013-05-07 10:55 UTC (permalink / raw)
To: emacs-orgmode
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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-05-07 10:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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).