Mercurial > emacs
diff lisp/progmodes/python.el @ 106482:806e9f7990d8
* minibuffer.el (completion-at-point-functions): New var.
(completion-at-point): New command.
* indent.el (indent-for-tab-command): Handle the new `complete' behavior.
* progmodes/python.el (python-mode-map): Use completion-at-point.
(python-completion-at-point): Rename from python-partial-symbol and
adjust for use in completion-at-point-functions.
(python-mode): Setup completion-at-point for Python completion.
* emacs-lisp/lisp.el (lisp-completion-at-point): New function
extracted from lisp-complete-symbol.
(lisp-complete-symbol): Use it.
* emacs-lisp/lisp-mode.el (emacs-lisp-mode): Use define-derived-mode,
setup completion-at-point for Elisp completion.
(emacs-lisp-mode-map, lisp-interaction-mode-map): Use completion-at-point.
* ielm.el (ielm-map): Use completion-at-point.
(inferior-emacs-lisp-mode): Setup completion-at-point for Elisp completion.
* progmodes/sym-comp.el: Move to...
* obsolete/sym-comp.el: Move from progmodes.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 07 Dec 2009 20:06:26 +0000 |
parents | 26baacb565b0 |
children | 427e81917607 |
line wrap: on
line diff
--- a/lisp/progmodes/python.el Mon Dec 07 19:21:57 2009 +0000 +++ b/lisp/progmodes/python.el Mon Dec 07 20:06:26 2009 +0000 @@ -268,7 +268,7 @@ (define-key map "\C-c\C-z" 'python-switch-to-python) (define-key map "\C-c\C-m" 'python-load-file) (define-key map "\C-c\C-l" 'python-load-file) ; a la cmuscheme - (substitute-key-definition 'complete-symbol 'symbol-complete + (substitute-key-definition 'complete-symbol 'completion-at-point map global-map) (define-key map "\C-c\C-i" 'python-find-imports) (define-key map "\C-c\C-t" 'python-expand-template) @@ -319,7 +319,7 @@ "-" ["Help on symbol" python-describe-symbol :help "Use pydoc on symbol at point"] - ["Complete symbol" symbol-complete + ["Complete symbol" completion-at-point :help "Complete (qualified) symbol before point"] ["Find function" python-find-function :help "Try to find source definition of function at point"] @@ -2159,8 +2159,7 @@ (delete-dups completions) #'string<)))) -(defun python-partial-symbol () - "Return the partial symbol before point (for completion)." +(defun python-completion-at-point () (let ((end (point)) (start (save-excursion (and (re-search-backward @@ -2168,7 +2167,9 @@ (group (1+ (regexp "[[:alnum:]._]"))) point) nil t) (match-beginning 1))))) - (if start (buffer-substring-no-properties start end)))) + (when start + (list start end + (completion-table-dynamic 'python-symbol-completions))))) ;;;; FFAP support @@ -2471,10 +2472,8 @@ (add-hook 'eldoc-mode-hook (lambda () (run-python nil t)) ; need it running nil t) - (set (make-local-variable 'symbol-completion-symbol-function) - 'python-partial-symbol) - (set (make-local-variable 'symbol-completion-completions-function) - 'python-symbol-completions) + (add-hook 'completion-at-point-functions + 'python-completion-at-point nil 'local) ;; Fixme: should be in hideshow. This seems to be of limited use ;; since it isn't (can't be) indentation-based. Also hide-level ;; doesn't seem to work properly. @@ -2488,12 +2487,6 @@ '((< '(backward-delete-char-untabify (min python-indent (current-column)))) (^ '(- (1+ (current-indentation)))))) - ;; Let's not mess with hippie-expand. Symbol-completion should rather be - ;; bound to another key, since it has different performance requirements. - ;; (if (featurep 'hippie-exp) - ;; (set (make-local-variable 'hippie-expand-try-functions-list) - ;; (cons 'symbol-completion-try-complete - ;; hippie-expand-try-functions-list))) ;; Python defines TABs as being 8-char wide. (set (make-local-variable 'tab-width) 8) (unless font-lock-mode (font-lock-mode 1))