[IPython-dev] %edit magic in new frontends
Thomas Kluyver
takowl at gmail.com
Thu May 26 08:56:04 EDT 2011
Bringing this discussion onto the list, it started on a pull request here:
https://github.com/ipython/ipython/pull/460#issuecomment-1214412
In the plain terminal frontend, calling %edit brings up an editor, typically
something inside the terminal like nano or vi, and blocks until the editor
closes. Then, depending on how it was called, it can execute the code that's
just been edited, redefine a macro if you were editing one, or take no
action. In addition, it may spit out the edited code as a string so you can
reuse it.
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.
* I say 'will' because in fact it currently does nothing by default, but
that should be sorted soon.
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.
Thanks,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20110526/84ae2029/attachment.html>
More information about the IPython-dev
mailing list