pmacs3/method/spell.py

17 lines
541 B
Python
Raw Permalink Normal View History

2008-11-12 10:52:01 -05:00
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()