From dff9ba2920f3d48714ea4d03f5dae9049d48c962 2006-07-08 09:32:30 From: vivainio Date: 2006-07-08 09:32:30 Subject: [PATCH] %cpaste now strips > from the beginning of lines, after a patch by Stefan van der Walt. --- diff --git a/IPython/Magic.py b/IPython/Magic.py index 0ee6508..ae5c2b2 100644 --- a/IPython/Magic.py +++ b/IPython/Magic.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- """Magic functions for InteractiveShell. -$Id: Magic.py 1380 2006-06-27 11:34:39Z vivainio $""" +$Id: Magic.py 1386 2006-07-08 09:32:30Z vivainio $""" #***************************************************************************** # Copyright (C) 2001 Janko Hauser and @@ -2915,8 +2915,10 @@ Defaulting color scheme to 'NoColor'""" is the new sentinel for this operation) The block is dedented prior to execution to enable execution of - method definitions. The executed block is also assigned to variable - named 'pasted_block' for later editing with '%edit pasted_block'. + method definitions. '>' characters at the beginning of a line is + ignored, to allow pasting directly from e-mails. The executed block + is also assigned to variable named 'pasted_block' for later editing + with '%edit pasted_block'. You can also pass a variable name as an argument, e.g. '%cpaste foo'. This assigns the pasted block to variable 'foo' as string, without @@ -2939,7 +2941,7 @@ Defaulting color scheme to 'NoColor'""" l = iplib.raw_input_original(':') if l ==sentinel: break - lines.append(l) + lines.append(l.lstrip('>')) block = "\n".join(lines) + '\n' #print "block:\n",block if not par: diff --git a/doc/ChangeLog b/doc/ChangeLog index 4716ec2..c71b1f4 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,9 @@ +2006-07-08 Ville Vainio + + * Magic.py: %cpaste now strips > from the beginning of lines + to ease pasting quoted code from emails. Contributed by + Stefan van der Walt. + 2006-06-29 Ville Vainio * ipmaker.py, Shell.py: qt4agg matplotlib backend support for pylab