Commits

Ali Gholami Rudi  committed 792e3e4

Highlighting the preview and committing it

  • Participants
  • Parent commits 0a77827

Comments (0)

Files changed (4)

File docs/done.txt

  Done
 ======
 
+- previewing changes : November 27, 2007
 - specifying refactoring options : November 26, 2007
 - restructuring support : November 26, 2007
 - added ``rope-confirm-saving`` variable : November 26, 2007

File docs/todo.txt

 
 * new file/directory/module/package; C-x p n [fdmp]
 * showing proposal type in code-assist
-* previewing changes

File ropemacs/__init__.py

         return calculate.result
 
 
-def _make_buffer(name, contents, empty_goto=True):
+def _make_buffer(name, contents, empty_goto=True, mode=None):
     new_buffer = lisp.get_buffer_create(name)
     lisp.set_buffer(new_buffer)
     lisp.erase_buffer()
     if contents or empty_goto:
         lisp.insert(contents)
+        if mode is not None:
+            lisp[mode + '-mode']()
         lisp.display_buffer(new_buffer)
         lisp.goto_line(1)
 
+def _y_or_n_p(prompt):
+    return lisp.y_or_n_p(prompt)
+
 
 DEFVARS = """\
 (defvar rope-confirm-saving t

File ropemacs/refactor.py

             self._perform(changes)
         if action == 'preview':
             ropemacs._make_buffer('*rope-preview*',
-                                  str(changes.get_description()))
+                                  str(changes.get_description()),
+                                  mode='diff')
+            if ropemacs._y_or_n_p('Do the changes? '):
+                self._perform(changes)
 
     @property
     def project(self):