diff --git a/IPython/Magic.py b/IPython/Magic.py index 2657479..07c5737 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -3210,7 +3210,7 @@ Defaulting color scheme to 'NoColor'""" This assigns the pasted block to variable 'foo' as string, without dedenting or executing it (preceding >>> and + is still stripped) - '%cpaste rep' re-executes the block previously entered by cpaste. + '%cpaste -r' re-executes the block previously entered by cpaste. Do not be alarmed by garbled output on Windows (it's a readline bug). Just press enter and type -- (and press enter again) and the block @@ -3218,15 +3218,14 @@ Defaulting color scheme to 'NoColor'""" IPython statements (magics, shell escapes) are not supported (yet). """ - opts,args = self.parse_options(parameter_s,'s:',mode='string') + opts,args = self.parse_options(parameter_s,'rs:',mode='string') par = args.strip() - if par == 'rep': + if opts.has_key('r'): b = self.user_ns.get('pasted_block', None) if b is None: raise UsageError('No previous pasted block available') print "Re-executing '%s...' (%d chars)"% (b.split('\n',1)[0], len(b)) exec b in self.user_ns - return sentinel = opts.get('s','--') diff --git a/docs/source/changes.txt b/docs/source/changes.txt index ffa88a6..3ff6d3e 100644 --- a/docs/source/changes.txt +++ b/docs/source/changes.txt @@ -104,6 +104,7 @@ New features * 'cd --foo' searches directory history for string foo, and jumps to that dir. Last part of dir name is checked first. If no matches for that are found, look at the whole path. + * '%cpaste -r' re-executes the block previously executed by cpaste. Bug fixes ---------