From 9bdaaa584d8514f7cf089740ae0a50ed26edc2c6 2006-01-08 16:23:20 From: fperez Date: 2006-01-08 16:23:20 Subject: [PATCH] fix tab-completion bug in embedded ipython reported by Arnd --- diff --git a/IPython/completer.py b/IPython/completer.py index 99e808a..ebf4152 100644 --- a/IPython/completer.py +++ b/IPython/completer.py @@ -80,7 +80,7 @@ except NameError: from sets import Set as set -from IPython.genutils import shlex_split +from IPython.genutils import shlex_split,debugp __all__ = ['Completer','IPCompleter'] @@ -392,6 +392,7 @@ class IPCompleter(Completer): def alias_matches(self, text): """Match internal system aliases""" + #print 'Completer->alias_matches:',text # dbg text = os.path.expanduser(text) aliases = self.alias_table.keys() @@ -402,7 +403,8 @@ class IPCompleter(Completer): def python_matches(self,text): """Match attributes or global python names""" - #print 'Completer->python_matches' # dbg + + #print 'Completer->python_matches, txt=<%s>' % text # dbg if "." in text: try: matches = self.attr_matches(text) diff --git a/IPython/iplib.py b/IPython/iplib.py index e6c61cc..49561d8 100644 --- a/IPython/iplib.py +++ b/IPython/iplib.py @@ -6,7 +6,7 @@ Requires Python 2.1 or newer. This file contains all the classes and helper functions specific to IPython. -$Id: iplib.py 994 2006-01-08 08:29:44Z fperez $ +$Id: iplib.py 995 2006-01-08 16:23:20Z fperez $ """ #***************************************************************************** @@ -844,6 +844,7 @@ class InteractiveShell(object,Magic): def ipsystem(self,arg_s): """Make a system call, using IPython.""" + self.system(arg_s) def complete(self,text): @@ -880,7 +881,7 @@ class InteractiveShell(object,Magic): outcomps.sort() return outcomps - def set_completer_frame(self, frame): + def set_completer_frame(self, frame=None): if frame: self.Completer.namespace = frame.f_locals self.Completer.global_namespace = frame.f_globals @@ -892,6 +893,7 @@ class InteractiveShell(object,Magic): """Define some aliases automatically. These are ALL parameter-less aliases""" + for alias,cmd in self.auto_alias: self.alias_table[alias] = (0,cmd) @@ -1346,7 +1348,7 @@ want to merge them back into the new files.""" % locals() # make sure the tab-completer has the correct frame information, so it # actually completes using the frame's locals/globals - self.set_completer_frame(call_frame) + self.set_completer_frame() # before activating the interactive mode, we need to make sure that # all names in the builtin namespace needed by ipython point to diff --git a/doc/ChangeLog b/doc/ChangeLog index de732f8..fe004a3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,5 +1,9 @@ 2006-01-08 Fernando Perez + * IPython/iplib.py (embed_mainloop): fix tab-completion in + embedded instances, for variables defined at the interactive + prompt of the embedded ipython. Reported by Arnd. + * IPython/Magic.py (magic_autocall): Fix %autocall magic. Now it can be used as a (stateful) toggle, or with a direct parameter.