help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: select a section of text and run it into another process?


From: Eric Abrahamsen
Subject: Re: select a section of text and run it into another process?
Date: Wed, 01 Apr 2015 20:08:45 +0800
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux)

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




reply via email to

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