diff options
| author | Fabián Ezequiel Gallina | 2012-05-17 00:03:37 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:37 -0300 |
| commit | cb37c7e369b7cde971e865ca89e2a455bb7479da (patch) | |
| tree | 12e27abb252d5b238cd716908281ee61cc79c273 /lisp | |
| parent | 0d0e6ccde63ad801353ed289049940a88d626fee (diff) | |
| download | emacs-cb37c7e369b7cde971e865ca89e2a455bb7479da.tar.gz emacs-cb37c7e369b7cde971e865ca89e2a455bb7479da.zip | |
Enhanced completion subject finding logic for `python-shell-completion--do-completion-at-point'
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/python.el | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 377ad72756f..520ed4eb29e 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1720,7 +1720,24 @@ completions on the current context." | |||
| 1720 | (defun python-shell-completion--do-completion-at-point (process) | 1720 | (defun python-shell-completion--do-completion-at-point (process) |
| 1721 | "Do completion at point for PROCESS." | 1721 | "Do completion at point for PROCESS." |
| 1722 | (with-syntax-table python-dotty-syntax-table | 1722 | (with-syntax-table python-dotty-syntax-table |
| 1723 | (let* ((beg (save-excursion (skip-syntax-backward "w") (point))) | 1723 | (let* ((beg |
| 1724 | (save-excursion | ||
| 1725 | (let* ((paren-depth (car (syntax-ppss))) | ||
| 1726 | (syntax-string "w_") | ||
| 1727 | (syntax-list (string-to-syntax syntax-string))) | ||
| 1728 | ;; Stop scanning for the beginning of the completion subject | ||
| 1729 | ;; after the char before point matches a delimiter | ||
| 1730 | (while (member (car (syntax-after (1- (point)))) syntax-list) | ||
| 1731 | (skip-syntax-backward syntax-string) | ||
| 1732 | (when (or (equal (char-before) ?\)) | ||
| 1733 | (equal (char-before) ?\")) | ||
| 1734 | (forward-char -1)) | ||
| 1735 | (while (or | ||
| 1736 | ;; honor initial paren depth | ||
| 1737 | (> (car (syntax-ppss)) paren-depth) | ||
| 1738 | (python-info-ppss-context 'string)) | ||
| 1739 | (forward-char -1)))) | ||
| 1740 | (point))) | ||
| 1724 | (end (point)) | 1741 | (end (point)) |
| 1725 | (line (buffer-substring-no-properties (point-at-bol) end)) | 1742 | (line (buffer-substring-no-properties (point-at-bol) end)) |
| 1726 | (input (buffer-substring-no-properties beg end)) | 1743 | (input (buffer-substring-no-properties beg end)) |
| @@ -1752,7 +1769,7 @@ completions on the current context." | |||
| 1752 | (completions | 1769 | (completions |
| 1753 | (and completion-code (> (length input) 0) | 1770 | (and completion-code (> (length input) 0) |
| 1754 | (python-shell-completion--get-completions | 1771 | (python-shell-completion--get-completions |
| 1755 | line process completion-code)))) | 1772 | input process completion-code)))) |
| 1756 | (list beg end completions)))) | 1773 | (list beg end completions)))) |
| 1757 | 1774 | ||
| 1758 | (defun python-shell-completion-complete-at-point () | 1775 | (defun python-shell-completion-complete-at-point () |