Anonymous avatar Anonymous committed 9e0945b

autoimport: added _check_autoimport

Comments (0)

Files changed (1)

ropemacs/interface.py

         lisp.delete_region(starting_offset + 1, offset + 1)
         lisp.insert(result)
 
+    def _check_autoimport(self):
+        self._check_project()
+        if self.auto_import is None:
+            lisputils.message('autoimport is disabled; '
+                              'see `ropemacs-enable-autoimport\' variable')
+            return False
+        return True
+
     @interactive
     def auto_import(self):
-        self._check_project()
-        if self.autoimport is None:
+        if not self._check_autoimport():
             return
         name = lisp.current_word()
         modules = self.autoimport.get_modules(name)
 
     @interactive
     def complete_and_import(self):
-        self._check_project()
-        if self.autoimport is None:
+        if not self._check_autoimport():
             return
         starting = lisp.current_word()
         proposals = [x[0] + ' : ' + x[1]
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.