started moving to newer-style exception (finally)
--HG-- branch : pmacs2
This commit is contained in:
parent
b725b91375
commit
9c2927df14
|
@ -623,7 +623,7 @@ class Application(object):
|
|||
try:
|
||||
pipe = Popen(args)
|
||||
pipe.wait()
|
||||
except OSError, e:
|
||||
except OSError(e):
|
||||
self.set_error("%s: %s" % (args[0], e))
|
||||
curses.reset_prog_mode()
|
||||
self.win.redrawwin()
|
||||
|
|
|
@ -281,7 +281,7 @@ class Buffer(object):
|
|||
llen = len(lines)
|
||||
assert llen > 0
|
||||
if not force and self.readonly():
|
||||
raise ReadOnlyError, "buffer is read-only"
|
||||
raise ReadOnlyError("buffer is read-only")
|
||||
p2 = p.vadd(len(lines[-1]), llen - 1)
|
||||
if llen > 1:
|
||||
self.lines.insert(p.y + 1, [])
|
||||
|
@ -301,7 +301,7 @@ class Buffer(object):
|
|||
def delete(self, p1, p2, act=ACT_NORM, force=False):
|
||||
"""delete characters from p1 up to p2 from the buffer"""
|
||||
if not force and self.readonly():
|
||||
raise ReadOnlyError, "buffer is read-only"
|
||||
raise ReadOnlyError("buffer is read-only")
|
||||
self._validate_point(p1)
|
||||
self._validate_point(p2)
|
||||
if p1 == p2:
|
||||
|
@ -511,7 +511,7 @@ class FileBuffer(Buffer):
|
|||
return self.checksum.digest() != m.digest()
|
||||
def save(self, force=False):
|
||||
if self.readonly():
|
||||
raise ReadOnlyError, "can't save read-only file"
|
||||
raise ReadOnlyError("can't save read-only file")
|
||||
|
||||
if self.checksum is not None and force is False:
|
||||
# the file already existed and we took a checksum so make sure it's
|
||||
|
|
2
lex.py
2
lex.py
|
@ -124,7 +124,7 @@ class OverridePatternRule(PatternRule):
|
|||
#lexer.mode.gstack['%s.start' % d['token']] = mode
|
||||
lexer.mode.gstack['%s' % d['token']] = mode
|
||||
else:
|
||||
raise OverrideError, "argh: %r" % mode
|
||||
raise OverrideError("argh: %r" % mode)
|
||||
except (KeyError, AttributeError, OverrideError):
|
||||
pass
|
||||
yield self.make_token(lexer, m.group(0), self.name, parent, d)
|
||||
|
|
|
@ -898,7 +898,7 @@ class RegisterSave(Method):
|
|||
h="Name of the register to use")]
|
||||
def _pre_execute(self, w, **vargs):
|
||||
if not w.has_kill():
|
||||
raise MethodError, "No text on the kill stack"
|
||||
raise MethodError("No text on the kill stack")
|
||||
def _execute(self, w, **vargs):
|
||||
name = vargs['name']
|
||||
text = w.get_kill()
|
||||
|
|
|
@ -71,7 +71,7 @@ class Handler(object):
|
|||
return None
|
||||
self.curr_tokens = []
|
||||
self.last_sequence = sequence
|
||||
raise ActionError, "no action defined for %r" % (sequence)
|
||||
raise ActionError("no action defined for %r" % (sequence))
|
||||
|
||||
class Fundamental(Handler):
|
||||
'''This is the default mode'''
|
||||
|
|
|
@ -17,7 +17,7 @@ def _make_regex(w, s):
|
|||
else:
|
||||
return re.compile(s)
|
||||
except:
|
||||
raise searchutil.IllegalPatternError, "failed to compile: %r" % s
|
||||
raise searchutil.IllegalPatternError("failed to compile: %r" % s)
|
||||
|
||||
class SearchNext(method.Method):
|
||||
def execute(self, w, **vargs):
|
||||
|
|
|
@ -34,7 +34,7 @@ def find_ranges(r, w, start=None, end=None):
|
|||
limit = len(w.buffer.lines[y])
|
||||
for m in r.finditer(w.buffer.lines[y], x, limit):
|
||||
if len(m.group(0)) == 0:
|
||||
raise IllegalPatternError, "zero-width match found"
|
||||
raise IllegalPatternError("zero-width match found")
|
||||
p1, p2 = Point(m.start(), y), Point(m.end(), y)
|
||||
hr = HighlightRegion(w, p1, p2, BG, UNSELECTED, match=m, name='search')
|
||||
ranges.append(hr)
|
||||
|
|
Loading…
Reference in New Issue