Giter Club home page Giter Club logo

Comments (11)

m2ym avatar m2ym commented on May 17, 2024

Please check the following:

  1. Is AC mode is enabled ?
  2. Is ac-auto-start non-nil ?
  3. M-: (auto-complete '(ac-source-ropemacs))

from auto-complete.

seagle0128 avatar seagle0128 commented on May 17, 2024

Thanks for your update :)
Answers:

  1. AC mode is ON
  2. ac-auto-start is 2
  3. nil

My configurations is below.
;; Auto Complete
(require 'auto-complete-config)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/site-lisp/auto-complete/dict")
(ac-config-default)
;; for python-mode
(ac-ropemacs-initialize)
(add-hook 'python-mode-hook
(lambda ()
(add-to-list 'ac-sources 'ac-source-ropemacs)))
;; for c/c++ mode
(add-hook 'c-mode-common-hook
'(lambda()
(add-to-list 'ac-sources 'ac-source-semantic)))
(define-key ac-completing-map "\C-n" 'ac-next)
(define-key ac-completing-map "\C-p" 'ac-previous)
(setq ac-auto-start 2)
(setq ac-dwim t)
(global-set-key "\M-/" 'ac-start)
(define-key ac-completing-map "\M-/" 'ac-stop)
(ac-set-trigger-key "TAB")
(define-key ac-mode-map (kbd "M-TAB") 'auto-complete)

from auto-complete.

m2ym avatar m2ym commented on May 17, 2024

Can you get completions by M-: (rope-completions) at the position ?

from auto-complete.

seagle0128 avatar seagle0128 commented on May 17, 2024

Yes. I can get them. And M-/ runs the command rope-code-assist if AC mode is enabled.

from auto-complete.

m2ym avatar m2ym commented on May 17, 2024

Please try again after evaluating the following code:

(setq ac-source-ropemacs
'((init
. (lambda ()
(setq ac-ropemacs-completions-cache
(mapcar
(lambda (completion)
(concat ac-prefix completion))
(rope-completions)))))
(candidates . ac-ropemacs-completions-cache)))

from auto-complete.

m2ym avatar m2ym commented on May 17, 2024

You may get errors or ac-ropemacs-completions-cache is forever nil.

from auto-complete.

seagle0128 avatar seagle0128 commented on May 17, 2024

Yes, ac-ropemacs-completions-cache is always nil, so still not work. What should I do?

from auto-complete.

m2ym avatar m2ym commented on May 17, 2024

Hmm... I have to look into more deeply. Sorry for inconvenience.

from auto-complete.

seagle0128 avatar seagle0128 commented on May 17, 2024

Okay, Thanks for your great work! I like AC. Please let me know if you need help.

from auto-complete.

seagle0128 avatar seagle0128 commented on May 17, 2024

I use the configuration on http://www.enigmacurry.com/2009/01/21/autocompleteel-python-code-completion-in-emacs/, but cannot work well yet. Please refer to the latest comment.

(add-hook 'python-mode-hook
(lambda ()
(auto-complete-mode 1)
(set (make-local-variable 'ac-sources)
(append ac-sources '(ac-source-rope)))
; (append ac-sources '(ac-source-rope) '(ac-source-yasnippet)))
(set (make-local-variable 'ac-find-function) 'ac-python-find)
(set (make-local-variable 'ac-candidate-function) 'ac-python-candidate)
(set (make-local-variable 'ac-auto-start) nil)))

(set (make-local-variable 'ac-sources) (append ac-sources '(ac-source-yasnippet)))
(setq ac-auto-start nil)
(ac-set-trigger-key "TAB")

from auto-complete.

seagle0128 avatar seagle0128 commented on May 17, 2024

I found the ultimate solution. Hope it works for you.

(ac-ropemacs-initialize)

(defvar dss-ropemacs-completions-cache nil)
(defun dss/rope-candidates (prefix)
(with-no-warnings
(setq dss-ropemacs-completions-cache
(mapcar
(lambda (completion)
(concat ac-prefix completion))
(ignore-errors
(rope-completions)))))
dss-ropemacs-completions-cache)

(ac-define-source dss-rope
'((candidates . (dss/rope-candidates ac-prefix))
(requires . 0)
(cache . t)
(symbol . "f")))

(ac-define-source dss-rope-dot
'((candidates . (dss/rope-candidates ac-prefix))
(prefix . c-dot)
(requires . 0)
(cache . t)
(symbol . "f")))

(add-hook 'python-mode-hook
(lambda ()
(setq ac-sources (append '(ac-source-yasnippet ac-source-dss-rope ac-source-dss-rope-dot) ac-sources))))

from auto-complete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.