diff options
| author | Kenichi Handa | 2014-06-28 10:35:48 +0900 |
|---|---|---|
| committer | Kenichi Handa | 2014-06-28 10:35:48 +0900 |
| commit | f036e167feaf875873636972b28a4adc12c32254 (patch) | |
| tree | 440e45ae8951f7030393b130b184f2b1882070ee /lisp/progmodes/python.el | |
| parent | 1fc00e5c9e87c88b4b253692d6ade822f6d74d3e (diff) | |
| parent | 2c4e2e6fd3096eb615504e3cfc89c588ec620f78 (diff) | |
| download | emacs-f036e167feaf875873636972b28a4adc12c32254.tar.gz emacs-f036e167feaf875873636972b28a4adc12c32254.zip | |
merge trunk
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." | |||
| 2461 | (and completion-code | 2461 | (and completion-code |
| 2462 | (> (length input) 0) | 2462 | (> (length input) 0) |
| 2463 | (with-current-buffer (process-buffer process) | 2463 | (with-current-buffer (process-buffer process) |
| 2464 | (let ((completions (python-shell-send-string-no-output | 2464 | (let ((completions |
| 2465 | (format completion-code input) process))) | 2465 | (python-util-strip-string |
| 2466 | (python-shell-send-string-no-output | ||
| 2467 | (format completion-code input) process)))) | ||
| 2466 | (and (> (length completions) 2) | 2468 | (and (> (length completions) 2) |
| 2467 | (split-string completions | 2469 | (split-string completions |
| 2468 | "^'\\|^\"\\|;\\|'$\\|\"$" t))))))) | 2470 | "^'\\|^\"\\|;\\|'$\\|\"$" t))))))) |
| @@ -3648,6 +3650,14 @@ returned as is." | |||
| 3648 | n (1- n))) | 3650 | n (1- n))) |
| 3649 | (reverse acc)))) | 3651 | (reverse acc)))) |
| 3650 | 3652 | ||
| 3653 | (defun python-util-strip-string (string) | ||
| 3654 | "Strip STRING whitespace and newlines from end and beginning." | ||
| 3655 | (replace-regexp-in-string | ||
| 3656 | (rx (or (: string-start (* (any whitespace ?\r ?\n))) | ||
| 3657 | (: (* (any whitespace ?\r ?\n)) string-end))) | ||
| 3658 | "" | ||
| 3659 | string)) | ||
| 3660 | |||
| 3651 | 3661 | ||
| 3652 | (defun python-electric-pair-string-delimiter () | 3662 | (defun python-electric-pair-string-delimiter () |
| 3653 | (when (and electric-pair-mode | 3663 | (when (and electric-pair-mode |
| @@ -3736,7 +3746,7 @@ returned as is." | |||
| 3736 | 3746 | ||
| 3737 | (set (make-local-variable 'outline-regexp) | 3747 | (set (make-local-variable 'outline-regexp) |
| 3738 | (python-rx (* space) block-start)) | 3748 | (python-rx (* space) block-start)) |
| 3739 | (set (make-local-variable 'outline-heading-end-regexp) ":\\s-*\n") | 3749 | (set (make-local-variable 'outline-heading-end-regexp) ":[^\n]*\n") |
| 3740 | (set (make-local-variable 'outline-level) | 3750 | (set (make-local-variable 'outline-level) |
| 3741 | #'(lambda () | 3751 | #'(lambda () |
| 3742 | "`outline-level' function for Python mode." | 3752 | "`outline-level' function for Python mode." |