4

I'm trying to use Ropemacs with AutoComplete in Emacs but I keep getting a Debugger error:

Debugger entered--Lisp error: (void-function rope-completions)
  (rope-completions)
  eval((rope-completions))
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)

The symbol rope-completions has no documentation from C-h S. It only appears once, in the auto-complete-config. I've downloaded the latest ropemacs, ropemode, pymacs, python-rope and probably borked any apt system consistency I had.

When I remove this function from the config files auto-complete turns the cursor red when it tries to complete. I can't find reference to this function anywhere on my system.

Auto-complete is working perfectly for me in Lisp. How can I get auto-complete and Rope to work together to give me auto-completion for Python in Emacs?

EDIT: I cannot see the definition of rope-completions through C-h f. Here is the output of my Pymacs buffer:

<23 (version "0.24-beta2")
>45 eval pymacs_load_helper("ropemacs", "rope-")
<278    (return '(progn (pymacs-defuns '(0 rope--OldProgress nil 1 rope--LispProgress nil 2 rope-LispUtils nil 3 rope-message nil 4 rope--lisp-name nil 5 rope--load-ropemacs nil 6 rope--started-from-pymacs nil 7 rope-occurrences-goto "" 8 rope-occurrences-next "")) (pymacs-python 9)))
>45 eval pymacs_load_helper("ropemacs", "rope-")
<288    (return '(progn (pymacs-defuns '(10 rope--OldProgress nil 11 rope--LispProgress nil 12 rope-LispUtils nil 13 rope-message nil 14 rope--lisp-name nil 15 rope--load-ropemacs nil 16 rope--started-from-pymacs nil 17 rope-occurrences-goto "" 18 rope-occurrences-next "")) (pymacs-python 19)))
>51 eval free_python(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 19)
<13 (return nil)
>45 eval pymacs_load_helper("ropemacs", "rope-")
<279    (return '(progn (pymacs-defuns '(19 rope--OldProgress nil 9 rope--LispProgress nil 8 rope-LispUtils nil 7 rope-message nil 6 rope--lisp-name nil 5 rope--load-ropemacs nil 4 rope--started-from-pymacs nil 3 rope-occurrences-goto "" 2 rope-occurrences-next "")) (pymacs-python 1)))
Conor
  • 1,509
  • 2
  • 20
  • 28

2 Answers2

4

Do you have something like this in your emacs setting? (see also: agr / ropemacs / overview — Bitbucket )

(require 'pymacs)
(pymacs-load "ropemacs" "rope-")

If you have it, check that you have ropemacs command such as rope-open-project (C-x p o).

Note that rope-completions is defined as python function so you won't see its definition in elisp source.

You will see this when you hit C-h f rope-completions RET (not C-h S), if you load ropemacs properly.

rope-completions is an interactive Lisp function.

(rope-completions &rest ARGUMENTS)

It interfaces to a Python function.
tkf
  • 2,990
  • 18
  • 32
  • Thanks for your reply! I have copied http://www.enigmacurry.com/2009/01/21/autocompleteel-python-code-completion-in-emacs/ almost directly into my .emacs file. It still doesn't work :( – Conor Feb 02 '12 at 20:42
  • Can you check if you load ropemacs properly, like I described above? BTW, if you don't care about ropemacs and just want completion, maybe you should try http://chrispoole.com/project/ac-python/. – tkf Feb 03 '12 at 10:39
  • C-x p o is bound to the command icicle-bookmark-other-window (even in a Python buffer) and the command rope-open-project doesn't exist. I'll try out the link you pointed out today. – Conor Feb 03 '12 at 20:12
  • Then the problem is ropemacs (or pymacs), not auto-complete. First, check pymacs is loaded correctly. Remove all `(autoload 'pymacs-...)` lines and put `(require 'pymacs)`. If you have error when you start emacs, you don't have pymacs.el in load-path. If can see documentation when you type ` f pymacs-apply RET`, pymacs setting is OK. Then check that you can import rope in Emacs. Start python shell and check if `import rope`, `import ropemacs` or `import ropemode` fails. I guess at least one of them fails. If so, put these modules in your PYTHONPATH. – tkf Feb 03 '12 at 21:45
  • You say you copied "almost directly", but you never mention what version of ropemode/ropemacs you have. I had to install from hg at least to get completions (it's defined in ropemode/interface.py as def completions, the prefix "rope-" is added by pymacs) – unhammer Nov 21 '12 at 08:21
1

The only way I was able to do it in the end was to ignore all other tutorials and just use the Emacs For Python Github. It works really well, combines a lot of packages that I was looking to use anyway and is easy enough to configure so that it doesn't mess up my existing bindings and settings.

Conor
  • 1,509
  • 2
  • 20
  • 28