diff options
| author | Dan Davison | 2012-05-17 00:03:30 -0300 |
|---|---|---|
| committer | Fabián Ezequiel Gallina | 2012-05-17 00:03:30 -0300 |
| commit | 291e2b939b2240a748a33f298cb6188de4c79f3b (patch) | |
| tree | 09af04e122cc3ad162b7fd8adbd76270411f964c /lisp/progmodes/python.el | |
| parent | 9399498ea73905a1b6c35ad2238119534a90769f (diff) | |
| download | emacs-291e2b939b2240a748a33f298cb6188de4c79f3b.tar.gz emacs-291e2b939b2240a748a33f298cb6188de4c79f3b.zip | |
Dismiss completions buffer when unique completion has been made
Diffstat (limited to 'lisp/progmodes/python.el')
| -rw-r--r-- | lisp/progmodes/python.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 73b4776f7ab..a2f1ed4e809 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -1611,6 +1611,8 @@ and use the following as the value of this variable: | |||
| 1611 | :group 'python | 1611 | :group 'python |
| 1612 | :safe 'stringp) | 1612 | :safe 'stringp) |
| 1613 | 1613 | ||
| 1614 | (defvar python-completion-original-window-configuration nil) | ||
| 1615 | |||
| 1614 | (defun python-shell-completion--get-completions (input process completion-code) | 1616 | (defun python-shell-completion--get-completions (input process completion-code) |
| 1615 | "Retrieve available completions for INPUT using PROCESS. | 1617 | "Retrieve available completions for INPUT using PROCESS. |
| 1616 | Argument COMPLETION-CODE is the python code used to get | 1618 | Argument COMPLETION-CODE is the python code used to get |
| @@ -1638,7 +1640,12 @@ completions on the current context." | |||
| 1638 | (completion (when completions | 1640 | (completion (when completions |
| 1639 | (try-completion input completions)))) | 1641 | (try-completion input completions)))) |
| 1640 | (cond ((eq completion t) | 1642 | (cond ((eq completion t) |
| 1641 | t) | 1643 | (if (eq this-command last-command) |
| 1644 | (when python-completion-original-window-configuration | ||
| 1645 | (set-window-configuration | ||
| 1646 | python-completion-original-window-configuration))) | ||
| 1647 | (setq python-completion-original-window-configuration nil) | ||
| 1648 | t) | ||
| 1642 | ((null completion) | 1649 | ((null completion) |
| 1643 | (message "Can't find completion for \"%s\"" input) | 1650 | (message "Can't find completion for \"%s\"" input) |
| 1644 | (ding) | 1651 | (ding) |
| @@ -1648,6 +1655,9 @@ completions on the current context." | |||
| 1648 | (insert completion) | 1655 | (insert completion) |
| 1649 | t)) | 1656 | t)) |
| 1650 | (t | 1657 | (t |
| 1658 | (unless python-completion-original-window-configuration | ||
| 1659 | (setq python-completion-original-window-configuration | ||
| 1660 | (current-window-configuration))) | ||
| 1651 | (with-output-to-temp-buffer "*Python Completions*" | 1661 | (with-output-to-temp-buffer "*Python Completions*" |
| 1652 | (display-completion-list | 1662 | (display-completion-list |
| 1653 | (all-completions input completions))) | 1663 | (all-completions input completions))) |