Anonymous avatar Anonymous committed 792e3e4

Highlighting the preview and committing it

Comments (0)

Files changed (4)

  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
 
 * new file/directory/module/package; C-x p n [fdmp]
 * showing proposal type in code-assist
-* previewing changes

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

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):
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.