import sublime, sublime_plugin, re
class RemoveBlankLinesCommand(sublime_plugin.TextCommand):
____def run(self, edit=None):
________for x in self.view.sel():
____________s = re.sub(r'(?m)^ *\n', '', self.view.substr(x))
____________self.view.replace(edit, x, s)
class ExamleEvent(sublime_plugin.EventListener):
____def on_pre_save(self, view):
________view.run_command('remove_blank_lines')