diff options
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index eff599c77a5..c401cdfbf54 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -268,7 +268,7 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." | |||
| 268 | (define-key map "\C-c\C-z" 'python-switch-to-python) | 268 | (define-key map "\C-c\C-z" 'python-switch-to-python) |
| 269 | (define-key map "\C-c\C-m" 'python-load-file) | 269 | (define-key map "\C-c\C-m" 'python-load-file) |
| 270 | (define-key map "\C-c\C-l" 'python-load-file) ; a la cmuscheme | 270 | (define-key map "\C-c\C-l" 'python-load-file) ; a la cmuscheme |
| 271 | (substitute-key-definition 'complete-symbol 'symbol-complete | 271 | (substitute-key-definition 'complete-symbol 'completion-at-point |
| 272 | map global-map) | 272 | map global-map) |
| 273 | (define-key map "\C-c\C-i" 'python-find-imports) | 273 | (define-key map "\C-c\C-i" 'python-find-imports) |
| 274 | (define-key map "\C-c\C-t" 'python-expand-template) | 274 | (define-key map "\C-c\C-t" 'python-expand-template) |
| @@ -319,7 +319,7 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." | |||
| 319 | "-" | 319 | "-" |
| 320 | ["Help on symbol" python-describe-symbol | 320 | ["Help on symbol" python-describe-symbol |
| 321 | :help "Use pydoc on symbol at point"] | 321 | :help "Use pydoc on symbol at point"] |
| 322 | ["Complete symbol" symbol-complete | 322 | ["Complete symbol" completion-at-point |
| 323 | :help "Complete (qualified) symbol before point"] | 323 | :help "Complete (qualified) symbol before point"] |
| 324 | ["Find function" python-find-function | 324 | ["Find function" python-find-function |
| 325 | :help "Try to find source definition of function at point"] | 325 | :help "Try to find source definition of function at point"] |
| @@ -2159,8 +2159,7 @@ Uses `python-imports' to load modules against which to complete." | |||
| 2159 | (delete-dups completions) | 2159 | (delete-dups completions) |
| 2160 | #'string<)))) | 2160 | #'string<)))) |
| 2161 | 2161 | ||
| 2162 | (defun python-partial-symbol () | 2162 | (defun python-completion-at-point () |
| 2163 | "Return the partial symbol before point (for completion)." | ||
| 2164 | (let ((end (point)) | 2163 | (let ((end (point)) |
| 2165 | (start (save-excursion | 2164 | (start (save-excursion |
| 2166 | (and (re-search-backward | 2165 | (and (re-search-backward |
| @@ -2168,7 +2167,9 @@ Uses `python-imports' to load modules against which to complete." | |||
| 2168 | (group (1+ (regexp "[[:alnum:]._]"))) point) | 2167 | (group (1+ (regexp "[[:alnum:]._]"))) point) |
| 2169 | nil t) | 2168 | nil t) |
| 2170 | (match-beginning 1))))) | 2169 | (match-beginning 1))))) |
| 2171 | (if start (buffer-substring-no-properties start end)))) | 2170 | (when start |
| 2171 | (list start end | ||
| 2172 | (completion-table-dynamic 'python-symbol-completions))))) | ||
| 2172 | 2173 | ||
| 2173 | ;;;; FFAP support | 2174 | ;;;; FFAP support |
| 2174 | 2175 | ||
| @@ -2471,10 +2472,8 @@ with skeleton expansions for compound statement templates. | |||
| 2471 | (add-hook 'eldoc-mode-hook | 2472 | (add-hook 'eldoc-mode-hook |
| 2472 | (lambda () (run-python nil t)) ; need it running | 2473 | (lambda () (run-python nil t)) ; need it running |
| 2473 | nil t) | 2474 | nil t) |
| 2474 | (set (make-local-variable 'symbol-completion-symbol-function) | 2475 | (add-hook 'completion-at-point-functions |
| 2475 | 'python-partial-symbol) | 2476 | 'python-completion-at-point nil 'local) |
| 2476 | (set (make-local-variable 'symbol-completion-completions-function) | ||
| 2477 | 'python-symbol-completions) | ||
| 2478 | ;; Fixme: should be in hideshow. This seems to be of limited use | 2477 | ;; Fixme: should be in hideshow. This seems to be of limited use |
| 2479 | ;; since it isn't (can't be) indentation-based. Also hide-level | 2478 | ;; since it isn't (can't be) indentation-based. Also hide-level |
| 2480 | ;; doesn't seem to work properly. | 2479 | ;; doesn't seem to work properly. |
| @@ -2488,12 +2487,6 @@ with skeleton expansions for compound statement templates. | |||
| 2488 | '((< '(backward-delete-char-untabify (min python-indent | 2487 | '((< '(backward-delete-char-untabify (min python-indent |
| 2489 | (current-column)))) | 2488 | (current-column)))) |
| 2490 | (^ '(- (1+ (current-indentation)))))) | 2489 | (^ '(- (1+ (current-indentation)))))) |
| 2491 | ;; Let's not mess with hippie-expand. Symbol-completion should rather be | ||
| 2492 | ;; bound to another key, since it has different performance requirements. | ||
| 2493 | ;; (if (featurep 'hippie-exp) | ||
| 2494 | ;; (set (make-local-variable 'hippie-expand-try-functions-list) | ||
| 2495 | ;; (cons 'symbol-completion-try-complete | ||
| 2496 | ;; hippie-expand-try-functions-list))) | ||
| 2497 | ;; Python defines TABs as being 8-char wide. | 2490 | ;; Python defines TABs as being 8-char wide. |
| 2498 | (set (make-local-variable 'tab-width) 8) | 2491 | (set (make-local-variable 'tab-width) 8) |
| 2499 | (unless font-lock-mode (font-lock-mode 1)) | 2492 | (unless font-lock-mode (font-lock-mode 1)) |