aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorFabián Ezequiel Gallina2014-12-27 20:09:32 -0300
committerFabián Ezequiel Gallina2014-12-27 20:09:32 -0300
commit996ad1b846a0865245df008bdb551093278b3c30 (patch)
tree29046a955c31697dc9e54ceeab7e15865764797e /lisp/progmodes/python.el
parent3d1afd119e3cdb96178dd838ef833414b894d8d8 (diff)
parent433af0a06089885f5a57ef0f3e7d6283e8d51bd5 (diff)
downloademacs-996ad1b846a0865245df008bdb551093278b3c30.tar.gz
emacs-996ad1b846a0865245df008bdb551093278b3c30.zip
Merge from origin/emacs-24
433af0a * lisp/progmodes/python.el (python-shell-buffer-substring): Handle cornercase when region sent starts at point-min.
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el19
1 files changed, 9 insertions, 10 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 4dd7cbcd629..0b7d9169e6a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2728,17 +2728,16 @@ the python shell:
2728 4. Wraps indented regions under an \"if True:\" block so the 2728 4. Wraps indented regions under an \"if True:\" block so the
2729 interpreter evaluates them correctly." 2729 interpreter evaluates them correctly."
2730 (let* ((substring (buffer-substring-no-properties start end)) 2730 (let* ((substring (buffer-substring-no-properties start end))
2731 (buffer-substring-p (save-restriction 2731 (starts-at-point-min-p (save-restriction
2732 (widen) 2732 (widen)
2733 (not (equal (list (point-min) (point-max)) 2733 (= (point-min) start)))
2734 (list start end)))))
2735 (encoding (python-info-encoding)) 2734 (encoding (python-info-encoding))
2736 (fillstr (concat 2735 (fillstr (when (not starts-at-point-min-p)
2737 (when buffer-substring-p 2736 (concat
2738 (format "# -*- coding: %s -*-\n" encoding)) 2737 (format "# -*- coding: %s -*-\n" encoding)
2739 (make-string 2738 (make-string
2740 (- (line-number-at-pos start) 2739 ;; Substract 2 because of the coding cookie.
2741 (if buffer-substring-p 2 1)) ?\n))) 2740 (- (line-number-at-pos start) 2) ?\n))))
2742 (toplevel-block-p (save-excursion 2741 (toplevel-block-p (save-excursion
2743 (goto-char start) 2742 (goto-char start)
2744 (or (zerop (line-number-at-pos start)) 2743 (or (zerop (line-number-at-pos start))