Commits

Anonymous committed 0a77827

Showing change preview buffer

  • Participants
  • Parent commits b97ecf8

Comments (0)

Files changed (3)

File docs/todo.txt

 * adding a menu
 * including pymacs in ropemacs?
 * change pymacs to accept unicode strings
+* saving the old values of refacturing config
 
 > Public Release 0.2
 
 * new file/directory/module/package; C-x p n [fdmp]
 * showing proposal type in code-assist
 * previewing changes
-* showing refactoring progress

File ropemacs/__init__.py

         resource, offset = self._get_location()
         docs = codeassist.get_doc(
             self.project, lisp.buffer_string(), offset, resource)
-        pydoc_buffer = lisp.get_buffer_create('*rope-pydoc*')
-        lisp.set_buffer(pydoc_buffer)
-        lisp.erase_buffer()
-        if docs:
-            lisp.insert(docs)
-            lisp.display_buffer(pydoc_buffer)
+        _make_buffer('*rope-pydoc*', docs, empty_goto=False)
 
     @interactive
     def code_assist(self):
 
     def __call__(self):
         handle = taskhandle.TaskHandle(name=self.name)
-        _message('')
         progress = lisp.make_progress_reporter(
             '%s ... ' % self.name, 0, 100)
         def update_progress():
         return calculate.result
 
 
+def _make_buffer(name, contents, empty_goto=True):
+    new_buffer = lisp.get_buffer_create(name)
+    lisp.set_buffer(new_buffer)
+    lisp.erase_buffer()
+    if contents or empty_goto:
+        lisp.insert(contents)
+        lisp.display_buffer(new_buffer)
+        lisp.goto_line(1)
 
 
 DEFVARS = """\

File ropemacs/refactor.py

             return
         def calculate(handle):
             return self._calculate_changes(result, handle)
-        name = 'Performing %s' % self.name
+        name = 'Calculating %s changes' % self.name
         changes = ropemacs._RunTask(calculate, name=name)()
         if action == 'perform':
             self._perform(changes)
         if action == 'preview':
-            ropemacs._message('We\'ll preview it!')
+            ropemacs._make_buffer('*rope-preview*',
+                                  str(changes.get_description()))
 
     @property
     def project(self):