Path: blob/master/elisp/emacs-for-python/completion/ac-ropemacs-config.el
990 views
;; ropemacs Integration with auto-completion1;; Feature that can be added:2;; - (document . rope-get-doc) to get the doc for the symbol completed!3;; - Calltips (complete after a trigger (, maybe)45(defun ac-ropemacs-candidates ()6(mapcar (lambda (completion)7(concat ac-prefix completion))8(rope-completions)))910(defun ac-nropemacs-get-doc (symbol)11"Return the doc at point, currently it doesn't use symbol"12(rope-get-doc))131415(ac-define-source nropemacs16'((candidates . ac-ropemacs-candidates)17(symbol . "p")))1819(ac-define-source nropemacs-dot20'((candidates . ac-ropemacs-candidates)21(symbol . "p")22(prefix . c-dot)23(requires . 0)))2425(defun ac-nropemacs-setup ()26(setq ac-sources (append '(ac-source-nropemacs27ac-source-nropemacs-dot) ac-sources)))2829;; extended ropemacs3031(defun ac-eropemacs-candidates ()32(mapcar (lambda (proposal)33(destructuring-bind (name doc type) proposal34(list (concat ac-prefix name) doc35(if type (substring type 0 1) nil))))36(rope-extended-completions)))3738(defun ac-eropemacs-document (item) (car item))39(defun ac-eropemacs-symbol (item) (cadr item))4041(ac-define-source extended-ropemacs42'((candidates . ac-eropemacs-candidates)43;; (document . ac-eropemacs-document)44(symbol . ac-eropemacs-symbol)))4546(ac-define-source extended-ropemacs-dot47'((candidates . ac-eropemacs-candidates)48;; (document . ac-eropemacs-document)49(symbol . ac-eropemacs-symbol)50(prefix . c-dot)51(requires . 0)))5253(defun ac-eropemacs-setup ()54(setq ac-sources (append '(ac-source-extended-ropemacs55ac-source-extended-ropemacs-dot) ac-sources)))5657(defun ac-ropemacs-setup ()58(if (functionp 'rope-extended-completions)59(add-hook 'python-mode-hook 'ac-eropemacs-setup)60(add-hook 'python-mode-hook 'ac-nropemacs-setup)))616263