[IPython-dev] %edit magic in new frontends

Brian Granger ellisonbg at gmail.com
Tue May 31 23:39:22 EDT 2011


On Thu, May 26, 2011 at 2:04 PM, Fernando Perez <fperez.net at gmail.com> wrote:
> On Thu, May 26, 2011 at 5:56 AM, Thomas Kluyver <takowl at gmail.com> wrote:
>> In the Qt console, calling %edit will normally open the target in a GUI
>> editor.* Editors that can open multiple documents may not block the call,
>> although apparently some of them have command-line flags for that behaviour.
>> So as it stands, %edit in the Qt console will show you a file you can change
>> and save, but won't take any further action on it. Then again, since the Qt
>> console has decent editing capabilities itself, you can use the %recall and
>> %loadpy macros to bring code to the next prompt, and edit it there before
>> running it.
>
> It seems to me that %edit should, in the gui console, by default use
> the -x flag always.  This way it's useful as a mechanism to quickly
> load the thing you want to work on, but you're still responsible for
> saving and doing %run yourself.

+1

I would go a step further and say -x should be i) removed entirely or
ii) made the default in all frontends.

> That doesn't bother me too much, because I think that with the
> multiline capabilities of the Qt console, many of the use cases of
> %edit are now subsumed by simply recalling a previous cell with
> up-arrow and editing it right there.  And once the amount of code in
> the cell becomes large, it's probably best to just keep a persistent
> editor open using the classic 'save, alt-tab, run' cycle.
>
>> We should also consider how we will want %edit to work in other situations,
>> including the HTML notebook which is being prepared, and IPython as an
>> embedded widget in other software.
>
> Applications that embed the console can always override %edit to
> synchronize with their own mechanisms; Evan, does that sound
> reasonable for your use cases?
>
> As for the html notebook, it would be really cool if edit would open
> the file in-browser, either using a full-tab Codemirror cell or
> something like ymacs (http://www.ymacs.org/).  But the architectural
> decisions for magics with client-specific behavior are a bit tricky,
> since all code is actually executed in-kernel, and the same kernel can
> be simultaneously serving more than one client...
>
> Cheers,
>
> f
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com



More information about the IPython-dev mailing list