Anonymous committed ec27fc9

Added an option for saving files without asking

Comments (0)

Files changed (2)

 * specifying refactoring options
 * new file/directory/module/package; C-x p n [fdmp]
 * showing proposal type in code-assist
-* an option for saving files before refactorings without asking


-from Pymacs import lisp
 import rope.refactor.extract
 import rope.refactor.inline
 import rope.refactor.move
 import rope.refactor.rename
+from Pymacs import lisp
 from rope.base import project, libutils
 from rope.contrib import codeassist, generate
         lisp.add_hook(lisp.kill_emacs_hook, lisp.rope_exiting_actions)
         lisp.add_hook(lisp.python_mode_hook, lisp.rope_register_local_keys)
+        lisp(DEFVARS)
         self.global_keys = [
             ('C-x p o', lisp.rope_open_project),
             ('C-x p k', lisp.rope_close_project),
                 lisp.revert_buffer(None, 1)
-    def _save_buffers(self, ask=True, only_current=False):
+    def _save_buffers(self, only_current=False):
+        ask = lisp['rope-confirm-saving'].value()
         initial = lisp.current_buffer()
         current_buffer = lisp.current_buffer()
         if only_current:
 def _ask_values(prompt, values, starting=None, exact=None):
     return lisp.completing_read(prompt, values, None, exact, starting)
+DEFVARS = """\
+(defvar rope-confirm-saving t
+  "If non-nil, you have to confirm saving all modified
+python files before refactorings; otherwise they are
+saved automatically.")
 interface = RopeInterface()