From 291e2b939b2240a748a33f298cb6188de4c79f3b Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Thu, 17 May 2012 00:03:30 -0300 Subject: [PATCH] Dismiss completions buffer when unique completion has been made --- lisp/progmodes/python.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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: :group 'python :safe 'stringp) +(defvar python-completion-original-window-configuration nil) + (defun python-shell-completion--get-completions (input process completion-code) "Retrieve available completions for INPUT using PROCESS. Argument COMPLETION-CODE is the python code used to get @@ -1638,7 +1640,12 @@ completions on the current context." (completion (when completions (try-completion input completions)))) (cond ((eq completion t) - t) + (if (eq this-command last-command) + (when python-completion-original-window-configuration + (set-window-configuration + python-completion-original-window-configuration))) + (setq python-completion-original-window-configuration nil) + t) ((null completion) (message "Can't find completion for \"%s\"" input) (ding) @@ -1648,6 +1655,9 @@ completions on the current context." (insert completion) t)) (t + (unless python-completion-original-window-configuration + (setq python-completion-original-window-configuration + (current-window-configuration))) (with-output-to-temp-buffer "*Python Completions*" (display-completion-list (all-completions input completions))) -- 2.39.5