Anonymous avatar Anonymous committed 16c30ba

lisputils: added runtask function

Comments (0)

Files changed (3)

ropemacs/interface.py

             def undo(handle):
                 for changes in self.project.history.undo(task_handle=handle):
                     self._reload_buffers(changes, undo=True)
-            lisputils.RunTask(undo, 'Undo refactoring', interrupts=False)()
+            lisputils.runtask(undo, 'Undo refactoring', interrupts=False)
 
     @interactive
     def redo(self):
             def redo(handle):
                 for changes in self.project.history.redo(task_handle=handle):
                     self._reload_buffers(changes)
-            lisputils.RunTask(redo, 'Redo refactoring', interrupts=False)()
+            lisputils.runtask(redo, 'Redo refactoring', interrupts=False)
 
     def _get_region(self):
         offset1 = self._get_offset()
                 return codeassist.find_occurrences(
                     self.project, resource, offset,
                     unsure=unsure, resources=resources, task_handle=handle)
-            result = lisputils.RunTask(calculate, 'Find Occurrences')()
+            result = lisputils.runtask(calculate, 'Find Occurrences')
             text = []
             for occurrence in result:
                 line = '%s : %s' % (occurrence.resource.path, occurrence.offset)
         def generate(handle):
             self.autoimport.generate_cache(task_handle=handle)
             self.autoimport.generate_modules_cache(modules, task_handle=handle)
-        lisputils.RunTask(generate, 'Generate autoimport cache')()
+        lisputils.runtask(generate, 'Generate autoimport cache')
 
     def _insert_import(self, name, module):
         current = lisp.point()

ropemacs/lisputils.py

         return calculate.result
 
 
+def runtask(command, name, interrupts=True):
+    return RunTask(command, name, interrupts)()
+
 def create_progress(name):
     if _emacs_version() < 22:
         progress = _OldProgress(name)

ropemacs/refactor.py

         def calculate(handle):
             return self._calculate_changes(result, handle)
         name = 'Calculating %s changes' % self.name
-        changes = lisputils.RunTask(calculate, name=name)()
+        changes = lisputils.runtask(calculate, name=name)
         if action == 'perform':
             self._perform(changes)
         if action == 'preview':
             self.project.do(changes, task_handle=handle)
             self.interface._reload_buffers(changes)
             self._done()
-        lisputils.RunTask(perform, 'Making %s changes' % self.name,
-                          interrupts=False)()
+        lisputils.runtask(perform, 'Making %s changes' % self.name,
+                          interrupts=False)
         lisputils.message(str(changes.description) + ' finished')
 
     def _get_confs(self):
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.