* select a section of text and run it into another process?
@ 2015-03-31 11:15 Sayth Renshaw
2015-03-31 12:10 ` Eli Zaretskii
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Sayth Renshaw @ 2015-03-31 11:15 UTC (permalink / raw)
To: help-gnu-emacs
My emacs is going well, but something I would like to be able to do is run a section of code in a file and send it to an eshell process of python/ipython to evaluated.
How do I do this, I am not sure how to select the text without using the mouse, there are a lot of people guessing on this SO question (http://stackoverflow.com/questions/657672/how-to-select-or-highlight-a-block-in-emacs) but can anyone provide a solid answer?
In the emacs manual it shows this article for sending to process http://www.gnu.org/software/emacs/manual/html_node/elisp/Input-to-Processes.html
which means I assume I could make a keybinding adaption if this
(process-send-string "shell<1>" "ls\n")
(process-send-string "eshell<ipython>" "some version of selected text")
Any ideas or is there a plugin that already does this? I would like to be able to do this with multiple file types but python is where I am starting.
Thanks
Sayth
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: select a section of text and run it into another process?
2015-03-31 11:15 select a section of text and run it into another process? Sayth Renshaw
@ 2015-03-31 12:10 ` Eli Zaretskii
2015-03-31 16:02 ` Barry Margolin
2015-04-01 11:16 ` Sayth Renshaw
2 siblings, 0 replies; 8+ messages in thread
From: Eli Zaretskii @ 2015-03-31 12:10 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Tue, 31 Mar 2015 04:15:52 -0700 (PDT)
> From: Sayth Renshaw <flebber.crue@gmail.com>
>
> My emacs is going well, but something I would like to be able to do is run a section of code in a file and send it to an eshell process of python/ipython to evaluated.
To send a portion of text to a process (not eshell, but a program that
Emacs will invoke), select the text and then type "M-|". Emacs will
prompt for the command to invoke on this text.
> How do I do this, I am not sure how to select the text without using the mouse, there are a lot of people guessing on this SO question (http://stackoverflow.com/questions/657672/how-to-select-or-highlight-a-block-in-emacs) but can anyone provide a solid answer?
Type "C-SPC" on one edge of the text, then move to the other. That's
all; the text between those two points is now selected.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: select a section of text and run it into another process?
2015-03-31 11:15 select a section of text and run it into another process? Sayth Renshaw
2015-03-31 12:10 ` Eli Zaretskii
@ 2015-03-31 16:02 ` Barry Margolin
2015-04-01 8:15 ` Sayth Renshaw
2015-04-01 8:20 ` Sayth Renshaw
2015-04-01 11:16 ` Sayth Renshaw
2 siblings, 2 replies; 8+ messages in thread
From: Barry Margolin @ 2015-03-31 16:02 UTC (permalink / raw)
To: help-gnu-emacs
In article <c3ad0973-0926-4449-a7c8-d1076a6c8ec2@googlegroups.com>,
Sayth Renshaw <flebber.crue@gmail.com> wrote:
> My emacs is going well, but something I would like to be able to do is run a
> section of code in a file and send it to an eshell process of python/ipython
> to evaluated.
>
> How do I do this, I am not sure how to select the text without using the
> mouse, there are a lot of people guessing on this SO question
> (http://stackoverflow.com/questions/657672/how-to-select-or-highlight-a-block-
> in-emacs) but can anyone provide a solid answer?
That question is confusing because the question wasn't very clear that
it was talking about rectangular regions, not ordinary regions. Some of
the answers recognized this, some didn't.
The built-in Emacs tutorial explains how to mark a region, although it
doesn't really go into detail or use that term, it just describes the
process as part of the method of killing the region:
You can also kill any part of the text with one uniform method. Move
to one end of that part, and type C-@ or C-<SPC> (either one). (<SPC>
is the Space bar.) Move to the other end of that part, and type C-w.
That kills all the text between the two positions.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: select a section of text and run it into another process?
2015-03-31 11:15 select a section of text and run it into another process? Sayth Renshaw
2015-03-31 12:10 ` Eli Zaretskii
2015-03-31 16:02 ` Barry Margolin
@ 2015-04-01 11:16 ` Sayth Renshaw
2015-04-01 12:08 ` Eric Abrahamsen
2 siblings, 1 reply; 8+ messages in thread
From: Sayth Renshaw @ 2015-04-01 11:16 UTC (permalink / raw)
To: help-gnu-emacs
On Tuesday, 31 March 2015 22:16:00 UTC+11, Sayth Renshaw wrote:
> My emacs is going well, but something I would like to be able to do is run a section of code in a file and send it to an eshell process of python/ipython to evaluated.
>
> How do I do this, I am not sure how to select the text without using the mouse, there are a lot of people guessing on this SO question (http://stackoverflow.com/questions/657672/how-to-select-or-highlight-a-block-in-emacs) but can anyone provide a solid answer?
>
> In the emacs manual it shows this article for sending to process http://www.gnu.org/software/emacs/manual/html_node/elisp/Input-to-Processes.html
>
> which means I assume I could make a keybinding adaption if this
>
> (process-send-string "shell<1>" "ls\n")
>
> (process-send-string "eshell<ipython>" "some version of selected text")
>
> Any ideas or is there a plugin that already does this? I would like to be able to do this with multiple file types but python is where I am starting.
>
> Thanks
>
> Sayth
Actually think I found a solution there a some modes python.el already has an implementation.
There is isend-mode http://showterm.io/2b2a4b6759004598de4ee#slow which can be configured for any language. https://github.com/ffevotte/isend-mode.el
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: select a section of text and run it into another process?
2015-04-01 11:16 ` Sayth Renshaw
@ 2015-04-01 12:08 ` Eric Abrahamsen
0 siblings, 0 replies; 8+ messages in thread
From: Eric Abrahamsen @ 2015-04-01 12:08 UTC (permalink / raw)
To: help-gnu-emacs
Sayth Renshaw <flebber.crue@gmail.com> writes:
> On Tuesday, 31 March 2015 22:16:00 UTC+11, Sayth Renshaw wrote:
>> My emacs is going well, but something I would like to be able to do is run a section of code in a file and send it to an eshell process of python/ipython to evaluated.
>>
>> How do I do this, I am not sure how to select the text without using
>> the mouse, there are a lot of people guessing on this SO question
>> (http://stackoverflow.com/questions/657672/how-to-select-or-highlight-a-block-in-emacs)
>> but can anyone provide a solid answer?
>>
>> In the emacs manual it shows this article for sending to process http://www.gnu.org/software/emacs/manual/html_node/elisp/Input-to-Processes.html
>>
>> which means I assume I could make a keybinding adaption if this
>>
>> (process-send-string "shell<1>" "ls\n")
>>
>> (process-send-string "eshell<ipython>" "some version of selected text")
>>
>> Any ideas or is there a plugin that already does this? I would like to be able to do this with multiple file types but python is where I am starting.
>>
>> Thanks
>>
>> Sayth
>
> Actually think I found a solution there a some modes python.el already has an implementation.
>
> There is isend-mode http://showterm.io/2b2a4b6759004598de4ee#slow which can be configured for any language. https://github.com/ffevotte/isend-mode.el
Somebody ought to mention Org, which can take arbitrary chunks of
text/code and run them through external interpreters and "do things"
with the results. See the "Working with source code" section of the Org
manual.
Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2015-04-01 14:30 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-31 11:15 select a section of text and run it into another process? Sayth Renshaw
2015-03-31 12:10 ` Eli Zaretskii
2015-03-31 16:02 ` Barry Margolin
2015-04-01 8:15 ` Sayth Renshaw
2015-04-01 14:30 ` Eli Zaretskii
2015-04-01 8:20 ` Sayth Renshaw
2015-04-01 11:16 ` Sayth Renshaw
2015-04-01 12:08 ` Eric Abrahamsen
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).