Commits

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

ropemacs/__init__.py

-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.set_buffer(buffer)
                 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()
 _register_functions(interface)
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.