]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/python.el: Fix completions inside (i)pdb.
authorFabián Ezequiel Gallina <fgallina@gnu.org>
Mon, 4 Aug 2014 21:35:17 +0000 (18:35 -0300)
committerFabián Ezequiel Gallina <fgallina@gnu.org>
Mon, 4 Aug 2014 21:35:17 +0000 (18:35 -0300)
(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
lisp/progmodes/python.el

index 9039e43b0094239fd379692f38fc4351ddb189d6..c9b888f3c347bcf8a62093ec16cdb5b5a0723ba7 100644 (file)
@@ -1,3 +1,11 @@
+2014-08-04  Fabián Ezequiel Gallina  <fgallina@gnu.org>
+
+       * 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  <eggert@cs.ucla.edu>
 
        * rect.el (rectangle--default-line-number-format): Rename
index 6ed912f8cfd06972e0ef25f37f1bb42089e0b170..4ed24a4a4c68e59d051df9ebde0dc2be326ec504 100644 (file)
@@ -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)