: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
(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)
(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)))