Commits

Anonymous committed 0981726

autoimport: added docs on using autoimport

Comments (0)

Files changed (1)

 C-x p r           rope-redo
 C-x p c           rope-project-config
 C-x p n [mpfd]    rope-create-(module|package|file|directory)
+                  rope-write-project
 
 C-c r r           rope-rename
 C-c r l           rope-extract-variable
 C-c r d           rope-show-doc
 C-c r f           rope-find-occurrences
 C-c r ?           rope-lucky-assist
+
+                  rope-auto-import
+                  rope-complete-and-import
+                  rope-generate-autoimport-cache
 ===============   ============================
 
 These shortcut keys are enabled only when
 ================  ============================
 
 
+Enabling Autoimport
+-------------------
+
+Ropemacs provides two commands called ``rope-auto-import`` and
+``rope-complete-and-import`` that can be used to find the module a
+name is defined in and add an import for that name.  But they are
+disabled by default.  Before using them you should add::
+
+  (setq ropemacs-enable-autoimport 't)
+
+to your ``~/.emacs`` file.  After enabling, rope maintains a cache of
+global names for each project.  It updates the cache only when modules
+are changed; if you want to cache all your modules at once, use
+``rope-generate-autoimport-cache``.  It will cache all of the modules
+inside a project plus those whose names are listed in
+``ropemacs-autoimport-modules`` list::
+
+  # add the name of modules you want to autoimport
+  (setq ropemacs-autoimport-modules '("os" "shutil"))
+
+Now if you are in a buffer that contains::
+
+  rmtree
+
+and you execute ``ropemacs-auto-import`` you'll end up with::
+
+  from shutil import rmtree
+  rmtree
+
+``ropemacs-complete-and-import`` proposes names starting with the
+given word, too.  Note that these commands are not bound to a key by
+default.  You can do that yourself if you use them a lot.
+
+
 Variables
 ---------
 
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.