diff options
author | Glenn Morris <rgm@gnu.org> | 2014-06-21 12:45:59 -0700 |
---|---|---|
committer | Glenn Morris <rgm@gnu.org> | 2014-06-21 12:45:59 -0700 |
commit | c400516ab1d827d08225ffb3e1bc1969c73cc45e (patch) | |
tree | b16343b9e11c916c96b12ab56b6024cad91d3aff /lisp/progmodes/python.el | |
parent | 539ad293eb36b4cf458cbdb5a6b37f5cd1bb68a1 (diff) | |
parent | 8047f439ec7d0bbe0085800a13bee8da883ae4dd (diff) | |
download | emacs-c400516ab1d827d08225ffb3e1bc1969c73cc45e.tar.gz emacs-c400516ab1d827d08225ffb3e1bc1969c73cc45e.tar.bz2 emacs-c400516ab1d827d08225ffb3e1bc1969c73cc45e.zip |
Merge from emacs-24; up to 2014-06-06T02:22:40Z!monnier@iro.umontreal.ca
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r-- | lisp/progmodes/python.el | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 91a85526420..743981b3714 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2461,8 +2461,10 @@ LINE is used to detect the context on how to complete given INPUT." (and completion-code (> (length input) 0) (with-current-buffer (process-buffer process) - (let ((completions (python-shell-send-string-no-output - (format completion-code input) process))) + (let ((completions + (python-util-strip-string + (python-shell-send-string-no-output + (format completion-code input) process)))) (and (> (length completions) 2) (split-string completions "^'\\|^\"\\|;\\|'$\\|\"$" t))))))) @@ -3648,6 +3650,14 @@ returned as is." n (1- n))) (reverse acc)))) +(defun python-util-strip-string (string) + "Strip STRING whitespace and newlines from end and beginning." + (replace-regexp-in-string + (rx (or (: string-start (* (any whitespace ?\r ?\n))) + (: (* (any whitespace ?\r ?\n)) string-end))) + "" + string)) + (defun python-electric-pair-string-delimiter () (when (and electric-pair-mode @@ -3736,7 +3746,7 @@ returned as is." (set (make-local-variable 'outline-regexp) (python-rx (* space) block-start)) - (set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n") + (set (make-local-variable 'outline-heading-end-regexp) ":[^\n]*\n") (set (make-local-variable 'outline-level) #'(lambda () "`outline-level' function for Python mode." |