diff --git a/method/buffers.py b/method/buffers.py index 335c2f5..b99e1cf 100644 --- a/method/buffers.py +++ b/method/buffers.py @@ -57,8 +57,11 @@ class KillBuffer(Method): dv=default.current_buffer, h="name of the buffer to kill")] def _execute(self, w, **vargs): name = vargs['buffername'] - a = w.application - assert name in a.bufferlist.buffer_names, "Buffer %r does not exist" % name + a = w.application + if name not in a.bufferlist.buffer_names: + raise Exception("Buffer %r does not exist" % name) + elif len(a.bufferlist.buffers) == 1: + raise Exception("Can't close only open buffer") self._to_kill = a.bufferlist.buffer_names[name] self._old_window = w if self.force or not self._to_kill.changed(): diff --git a/mode/__init__.py b/mode/__init__.py index 0ab1551..c54726e 100644 --- a/mode/__init__.py +++ b/mode/__init__.py @@ -461,8 +461,7 @@ class Fundamental(Handler): if DEBUG: raise else: - err = "%s in mode '%s'" % (e, self.name) - self.window.set_error(err) + self.window.set_error(str(e)) def region_added(self, p, newlines): mname = self.name