From: Fabián Ezequiel Gallina Date: Thu, 17 May 2012 03:03:31 +0000 (-0300) Subject: Improved completion support when in [i]pdb X-Git-Tag: emacs-24.2.90~1199^2~520 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=aa4099353c10e0af0bbc11ca56a8be6243b3c882;p=emacs.git Improved completion support when in [i]pdb `python-shell-completion--do-completion-at-point' has been modified in order to support different completion contexts easily. New vars: + python-shell-completion-pdb-string-code --- diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 401d9fd0495..b4d388eb41d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1609,6 +1609,13 @@ and use the following as the value of this variable: :group 'python :safe 'stringp) +(defcustom python-shell-completion-pdb-string-code + "';'.join(globals().keys() + locals().keys())" + "Python code used to get completions separated by semicolons for [i]pdb." + :type 'string + :group 'python + :safe 'stringp) + (defvar python-shell-completion-original-window-configuration nil) (defun python-shell-completion--get-completions (input process completion-code) @@ -1628,14 +1635,20 @@ completions on the current context." (buffer-substring (point-at-bol) (point)) nil nil)) (input (substring-no-properties (or (comint-word (current-word)) "") nil nil)) - (completions - (if (and (> (length python-shell-completion-module-string-code) 0) + (completion-code + (cond ((and (> (length python-shell-completion-pdb-string-code) 0) + (string-match python-shell-prompt-pdb-regexp + (buffer-substring-no-properties + (overlay-start comint-last-prompt-overlay) + (overlay-end comint-last-prompt-overlay)))) + python-shell-completion-pdb-string-code) + ((and (> (length python-shell-completion-module-string-code) 0) (string-match "^\\(from\\|import\\)[ \t]" line)) - (python-shell-completion--get-completions - line process python-shell-completion-module-string-code) - (and (> (length input) 0) - (python-shell-completion--get-completions - input process python-shell-completion-string-code)))) + python-shell-completion-module-string-code) + (t python-shell-completion-string-code))) + (completions + (and (> (length input) 0) + (python-shell-completion--get-completions line process completion-code))) (completion (when completions (try-completion input completions)))) (cond ((eq completion t)