From 5ea39c0613cb7100189a1bb5e79de26d4fe7e8d0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fabi=C3=A1n=20Ezequiel=20Gallina?= Date: Mon, 4 Aug 2014 18:35:17 -0300 Subject: [PATCH] * lisp/progmodes/python.el: Fix completions inside (i)pdb. (python-shell-completion-pdb-string-code): Make obsolete. (python-shell-completion-get-completions): Use python-shell-completion-string-code resending setup code continuously for (i)pdb. --- lisp/ChangeLog | 8 ++++++++ lisp/progmodes/python.el | 20 ++++++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9039e43b00..c9b888f3c3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2014-08-04 Fabián Ezequiel Gallina + + * progmodes/python.el: Fix completions inside (i)pdb. + (python-shell-completion-pdb-string-code): Make obsolete. + (python-shell-completion-get-completions): Use + python-shell-completion-string-code resending setup code + continuously for (i)pdb. + 2014-08-04 Paul Eggert * rect.el (rectangle--default-line-number-format): Rename diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 6ed912f8cf..4ed24a4a4c 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2866,11 +2866,11 @@ the full statement in the case of imports." "24.4" "Completion string code must also autocomplete modules.") -(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) +(define-obsolete-variable-alias + 'python-shell-completion-pdb-string-code + 'python-shell-completion-string-code + "24.5" + "Completion string code must work for (i)pdb.") (defun python-shell-completion-get-completions (process import input) "Do completion at point using PROCESS for IMPORT or INPUT. @@ -2885,10 +2885,14 @@ completion." ;; Check whether a prompt matches a pdb string, an import ;; statement or just the standard prompt and use the ;; correct python-shell-completion-*-code string - (cond ((and (> (length python-shell-completion-pdb-string-code) 0) - (string-match + (cond ((and (string-match (concat "^" python-shell-prompt-pdb-regexp) prompt)) - python-shell-completion-pdb-string-code) + ;; Since there are no guarantees the user will remain + ;; in the same context where completion code was sent + ;; (e.g. user steps into a function), safeguard + ;; resending completion setup continuously. + (concat python-shell-completion-setup-code + "\nprint (" python-shell-completion-string-code ")")) ((string-match python-shell--prompt-calculated-input-regexp prompt) python-shell-completion-string-code) -- 2.39.2