From 87937a457d762faa1fc0b05128f73b4b527cd59a Mon Sep 17 00:00:00 2001 From: moculus Date: Wed, 12 Nov 2008 15:52:01 +0000 Subject: [PATCH] spelling --HG-- branch : pmacs2 --- application.py | 9 ++++++--- method/spell.py | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 method/spell.py diff --git a/application.py b/application.py index 0109300..99ac837 100755 --- a/application.py +++ b/application.py @@ -87,9 +87,12 @@ class Application(object): # initialize our methods self.methods = {} - names = ('method', 'method.svn', 'method.cvs', 'method.search', - 'method.buffers', 'method.move', 'method.shell', - 'method.introspect', 'method.help', 'method.numbers') + names = ( + 'method', 'method.svn', 'method.cvs', 'method.search', + 'method.buffers', 'method.move', 'method.shell', + 'method.introspect', 'method.help', 'method.numbers', + 'method.spell', + ) for name in names: exec("import %s" % name) mod = eval(name) diff --git a/method/spell.py b/method/spell.py new file mode 100644 index 0000000..2bce72c --- /dev/null +++ b/method/spell.py @@ -0,0 +1,16 @@ +import method + +class CheckSpelling(method.Method): + """Check the spelling of a buffer via ispell""" + ispell_args = ('ispell', '-x', '-M') + def _execute(self, w, **vargs): + # -x no backup file + # -M show context menu + if w.buffer.changed(): + w.set_error("There are unsaved changes; please save first.") + return + l = list(self.ispell_args) + l.append(w.buffer.path) + w.application.run_external(*l) + if w.buffer.changed_on_disk(): + w.buffer.reload()