help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Pymacs and auto complete


From: Andrea Crotti
Subject: Pymacs and auto complete
Date: Sun, 13 Feb 2011 20:40:31 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (darwin)

Today I found out that pymacs project is still alive, and I was quite
happy to see that it also supports py3k now.

To be completely happy I wanted to add a feature that I also have in
C/C++, whenever I press "." or "->" I get a nice completion over the
possibilities.

So I have this configuration:
--8<---------------cut here---------------start------------->8---
;; Initialize Pymacs                                                            
                               
(autoload 'pymacs-apply "pymacs")
(autoload 'pymacs-call "pymacs")
(autoload 'pymacs-eval "pymacs" nil t)
(autoload 'pymacs-exec "pymacs" nil t)
(autoload 'pymacs-load "pymacs" nil t)
;; Initialize Rope                                                              
                               
(pymacs-load "ropemacs" "rope-")
(setq ropemacs-enable-autoimport t)

;; now add the source rope
(add-hook 'python-mode-hook 
          (lambda ()
            (set (make-local-variable 'ac-sources)
                 (append ac-sources '(ac-source-ropemacs)))
))

(defun my-insert-dot-and-complete (arg)
  (interactive "p")
  (self-insert-command arg)
  (ac-start)
  )

(add-hook 'python-mode-hook
          (lambda () 
            (local-set-key "." 'my-insert-dot-and-complete)))
--8<---------------cut here---------------end--------------->8---


But the my-insert-dot-and-complete is not working very well, even if I
even set ac-auto-start to 0, I don't get any completion possible.

I looked how they do on semantic but it's way too many calls to function
involved.

The thing is that "rope-code-assist" interactively actually works and
gives me the right completion, but if I do 
(defun my-insert-dot-and-complete (arg)
  (interactive "p")
  (self-insert-command arg)
  (rope-code-assist (py-symbol-near-point))
  )

I don't get any possible match when writing

module.
I don't understand what is passed to the function rope-code-assist to
work when it's not interactive (and can't see the code).

Any idea/hint?

Thanks,
Andrea




reply via email to

[Prev in Thread] Current Thread [Next in Thread]