Commits

Ali Gholami Rudi  committed 9af57e1

autoimport: added ropemacs-autoimport-modules variable

  • Participants
  • Parent commits 074f7b4

Comments (0)

Files changed (1)

File ropemacs/interface.py

         self.project = None
         self.old_content = None
         lisp(DEFVARS)
+        #lisp['pymacs-forget-mutability'] = True
 
         self.global_keys = [
             ('o', lisp.rope_open_project),
             else:
                 proposal = lisputils.ask_values('Which to import: ',
                                                 proposals)
-            name, module = proposal.rsplit(' :', 1)
+            name, module = proposal.rsplit(' : ', 1)
             lisp.insert(name[len(starting):])
             self._insert_import(name, module)
         else:
             return
         for file in self.project.pycore.get_python_files():
             self.autoimport.update_resource(file)
+        modules = lisp['ropemacs-autoimport-modules'].value()
+        if modules:
+            for i in range(len(modules)):
+                modname = modules[i]
+                if not isinstance(modname, basestring):
+                    modname = modname.value()
+                self.autoimport.update_module(modname)
 
     def _insert_import(self, name, module):
         current = lisp.point()
 
 (defcustom ropemacs-enable-autoimport 'nil
   "Specifies whether autoimport should be enabled.")
+(defcustom ropemacs-autoimport-modules nil
+  "The name of modules whose global names should be cached.
+
+The `rope-generate-autoimport-cache' reads this list and fills its
+cache.")
 
 (make-obsolete-variable
   'rope-confirm-saving 'ropemacs-confirm-saving)