Show More
@@ -28,7 +28,8 b' def install_editor(run_template, wait = False):' | |||
|
28 | 28 | line = 0 |
|
29 | 29 | cmd = itplns(run_template, locals()) |
|
30 | 30 | print ">",cmd |
|
31 | os.system(cmd) | |
|
31 | if os.system(cmd) != 0: | |
|
32 | raise IPython.ipapi.TryNext() | |
|
32 | 33 | if wait: |
|
33 | 34 | raw_input("Press Enter when done editing:") |
|
34 | 35 |
@@ -2332,7 +2332,11 b' Currently the magic system has the following functions:\\n"""' | |||
|
2332 | 2332 | # do actual editing here |
|
2333 | 2333 | print 'Editing...', |
|
2334 | 2334 | sys.stdout.flush() |
|
2335 | self.shell.hooks.editor(filename,lineno) | |
|
2335 | try: | |
|
2336 | self.shell.hooks.editor(filename,lineno) | |
|
2337 | except IPython.ipapi.TryNext: | |
|
2338 | warn('Could not open editor') | |
|
2339 | return | |
|
2336 | 2340 | |
|
2337 | 2341 | # XXX TODO: should this be generalized for all string vars? |
|
2338 | 2342 | # For now, this is special-cased to blocks created by cpaste |
@@ -25,7 +25,8 b' ip = IPython.ipapi.get()' | |||
|
25 | 25 | def calljed(self,filename, linenum): |
|
26 | 26 | "My editor hook calls the jed editor directly." |
|
27 | 27 | print "Calling my own editor, jed ..." |
|
28 | os.system('jed +%d %s' % (linenum,filename)) | |
|
28 | if os.system('jed +%d %s' % (linenum,filename)) != 0: | |
|
29 | raise ipapi.TryNext() | |
|
29 | 30 | |
|
30 | 31 | ip.set_hook('editor', calljed) |
|
31 | 32 | |
@@ -84,7 +85,8 b' def editor(self,filename, linenum=None):' | |||
|
84 | 85 | editor = '"%s"' % editor |
|
85 | 86 | |
|
86 | 87 | # Call the actual editor |
|
87 | os.system('%s %s %s' % (editor,linemark,filename)) | |
|
88 | if os.system('%s %s %s' % (editor,linemark,filename)) != 0: | |
|
89 | raise ipapi.TryNext() | |
|
88 | 90 | |
|
89 | 91 | import tempfile |
|
90 | 92 | def fix_error_editor(self,filename,linenum,column,msg): |
@@ -105,7 +107,8 b' def fix_error_editor(self,filename,linenum,column,msg):' | |||
|
105 | 107 | return |
|
106 | 108 | t = vim_quickfix_file() |
|
107 | 109 | try: |
|
108 | os.system('vim --cmd "set errorformat=%f:%l:%c:%m" -q ' + t.name) | |
|
110 | if os.system('vim --cmd "set errorformat=%f:%l:%c:%m" -q ' + t.name): | |
|
111 | raise ipapi.TryNext() | |
|
109 | 112 | finally: |
|
110 | 113 | t.close() |
|
111 | 114 |
@@ -1419,8 +1419,12 b' want to merge them back into the new files.""" % locals()' | |||
|
1419 | 1419 | except TypeError: |
|
1420 | 1420 | return 0 |
|
1421 | 1421 | # always pass integer line and offset values to editor hook |
|
1422 | self.hooks.fix_error_editor(e.filename, | |
|
1423 | int0(e.lineno),int0(e.offset),e.msg) | |
|
1422 | try: | |
|
1423 | self.hooks.fix_error_editor(e.filename, | |
|
1424 | int0(e.lineno),int0(e.offset),e.msg) | |
|
1425 | except IPython.ipapi.TryNext: | |
|
1426 | warn('Could not open editor') | |
|
1427 | return False | |
|
1424 | 1428 | return True |
|
1425 | 1429 | |
|
1426 | 1430 | def edit_syntax_error(self): |
General Comments 0
You need to be logged in to leave comments.
Login now