aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
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 4a4e320cd65..0d80110f7b7 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -2523,17 +2523,16 @@ the python shell:
2523 4. Wraps indented regions under an \"if True:\" block so the 2523 4. Wraps indented regions under an \"if True:\" block so the
2524 interpreter evaluates them correctly." 2524 interpreter evaluates them correctly."
2525 (let* ((substring (buffer-substring-no-properties start end)) 2525 (let* ((substring (buffer-substring-no-properties start end))
2526 (buffer-substring-p (save-restriction 2526 (starts-at-point-min-p (save-restriction
2527 (widen) 2527 (widen)
2528 (not (equal (list (point-min) (point-max)) 2528 (= (point-min) start)))
2529 (list start end)))))
2530 (encoding (python-info-encoding)) 2529 (encoding (python-info-encoding))
2531 (fillstr (concat 2530 (fillstr (when (not starts-at-point-min-p)
2532 (when buffer-substring-p 2531 (concat
2533 (format "# -*- coding: %s -*-\n" encoding)) 2532 (format "# -*- coding: %s -*-\n" encoding)
2534 (make-string 2533 (make-string
2535 (- (line-number-at-pos start) 2534 ;; Substract 2 because of the coding cookie.
2536 (if buffer-substring-p 2 1)) ?\n))) 2535 (- (line-number-at-pos start) 2) ?\n))))
2537 (toplevel-block-p (save-excursion 2536 (toplevel-block-p (save-excursion
2538 (goto-char start) 2537 (goto-char start)
2539 (or (zerop (line-number-at-pos start)) 2538 (or (zerop (line-number-at-pos start))