Anonymous avatar Anonymous committed 20d6353

ropemacs: rope-module-to-package

Comments (0)

Files changed (1)

rope/contrib/ropemacs.py

         lisp.global_set_key('\x03g', lisp.rope_goto_definition)
         lisp.global_set_key('\x03rr', lisp.rope_rename)
         lisp.global_set_key('\x03r1r', lisp.rope_rename_current_module)
+        lisp.global_set_key('\x03r1p', lisp.rope_module_to_package)
         lisp.global_set_key('\x03rl', lisp.rope_extract_variable)
         lisp.global_set_key('\x03rm', lisp.rope_extract_method)
         lisp.global_set_key('\x03ri', lisp.rope_inline)
     def rename_current_module(self, newname):
         self.do_rename(newname, module=True)
 
+    @interactive()
+    def module_to_package(self):
+        self._check_project()
+        lisp.save_buffer()
+        packager = rope.refactor.ModuleToPackage(self.project,
+                                                 self._get_resource())
+        self._perform(packager.get_changes())
+
     def _do_extract(self, extractor, newname):
         self._check_project()
         lisp.save_buffer()
     def extract_method(self, newname):
         self._do_extract(rope.refactor.extract.ExtractMethod, newname)
 
-    @interactive('')
+    @interactive()
     def inline(self):
         self._check_project()
         lisp.save_some_buffers()
             self.project, resource, offset)
         self._perform(inliner.get_changes())
 
-    @interactive('')
+    @interactive()
     def organize_imports(self):
         self._check_project()
         lisp.save_buffer()
     def _get_offset(self):
         return lisp.point() - 1
 
-    @interactive('')
+    @interactive()
     def goto_definition(self):
         self._check_project()
         resource, offset = self._get_location()
 redo_refactoring = interface.redo_refactoring
 
 rename = interface.rename
-rename_current_module = interface.rename_current_module
 extract_variable = interface.extract_variable
 extract_method = interface.extract_method
 inline = interface.inline
+rename_current_module = interface.rename_current_module
+module_to_package = interface.module_to_package
 
 organize_imports = interface.organize_imports
 
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.