[IPython-user] two feature ideas
Alexander Schmolck
a.schmolck at gmx.net
Thu Feb 10 10:59:24 CST 2005
John Hunter <jdhunter at ace.bsd.uchicago.edu> writes:
> 2) Is it possible for ipython not to block on an edit command. Eg, if
> I dump a data file in ipython and am using emacsclient to feed data
> to my running emacs session in X, I would like to be able to send
> the data file to emacs with
>
> >>> edit 'somefile.dat'
>
> and not have it block my ipython session (and my gtk app I'm
> running under gthread)
I just use the following (if you add an if instance(object, basestring):... it'll
do what you want, I think):
# in ipythonrc
import_all ipythonrc_real
# amongst other things in ipythonrc_real:
_EDITOR=os.getenv("EDITOR")
def ed(object,editor=_EDITOR):
"""Start up an editor to edit the source code associated with a certain
python object (XXX assumes editor that takes +lineno switch)."""
lineN = inspect.getsourcelines(object)[1]
filename = inspect.getsourcefile(object)
os.system("%(editor)s +%(lineN)s %(filename)s&" % locals())
'as
More information about the IPython-user
mailing list