##// END OF EJS Templates
Reinstate newlines in %save and %macro, first part of issue 245.
Thomas Kluyver -
Show More
@@ -21,7 +21,7 b' class Macro(IPyAutocall):'
21
21
22 def __init__(self,data):
22 def __init__(self,data):
23 """store the macro value, as a single string which can be executed"""
23 """store the macro value, as a single string which can be executed"""
24 self.value = ''.join(data).rstrip()+'\n'
24 self.value = '\n'.join(data).rstrip()+'\n'
25
25
26 def __str__(self):
26 def __str__(self):
27 return self.value
27 return self.value
@@ -200,7 +200,7 b' python-profiler package from non-free.""")'
200 else:
200 else:
201 ini = int(chunk)
201 ini = int(chunk)
202 fin = ini+1
202 fin = ini+1
203 cmds.append(''.join(hist[ini:fin]))
203 cmds.append('\n'.join(hist[ini:fin]))
204 return cmds
204 return cmds
205
205
206 def arg_err(self,func):
206 def arg_err(self,func):
@@ -2079,10 +2079,9 b' Currently the magic system has the following functions:\\n"""'
2079 if ans.lower() not in ['y','yes']:
2079 if ans.lower() not in ['y','yes']:
2080 print 'Operation cancelled.'
2080 print 'Operation cancelled.'
2081 return
2081 return
2082 cmds = ''.join(self.extract_input_slices(ranges,opts.has_key('r')))
2082 cmds = '\n'.join(self.extract_input_slices(ranges,opts.has_key('r')))
2083 f = file(fname,'w')
2083 with open(fname,'w') as f:
2084 f.write(cmds)
2084 f.write(cmds)
2085 f.close()
2086 print 'The following commands were written to file `%s`:' % fname
2085 print 'The following commands were written to file `%s`:' % fname
2087 print cmds
2086 print cmds
2088
2087
General Comments 0
You need to be logged in to leave comments. Login now