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.el44
1 files changed, 26 insertions, 18 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 1fd4f326d3c..564638c1b58 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -599,24 +599,32 @@ START is the buffer position where the sexp starts."
599 (current-indentation))))) 599 (current-indentation)))))
600 indentation)) 600 indentation))
601 ('inside-paren 601 ('inside-paren
602 (- 602 (or (save-excursion
603 (save-excursion 603 (forward-comment 1)
604 (goto-char context-start) 604 (looking-at (regexp-opt '(")" "]" "}")))
605 (forward-char) 605 (forward-char 1)
606 (save-restriction 606 (when (not (nth 1 (syntax-ppss)))
607 (narrow-to-region 607 (goto-char context-start)
608 (line-beginning-position) 608 (back-to-indentation)
609 (line-end-position)) 609 (current-column)))
610 (forward-comment 1)) 610 (-
611 (if (looking-at "$") 611 (save-excursion
612 (+ (current-indentation) python-indent-offset) 612 (goto-char context-start)
613 (forward-comment 1) 613 (forward-char)
614 (current-column))) 614 (save-restriction
615 (if (progn 615 (narrow-to-region
616 (back-to-indentation) 616 (line-beginning-position)
617 (looking-at (regexp-opt '(")" "]" "}")))) 617 (line-end-position))
618 python-indent-offset 618 (forward-comment 1))
619 0)))))))) 619 (if (looking-at "$")
620 (+ (current-indentation) python-indent-offset)
621 (forward-comment 1)
622 (current-column)))
623 (if (progn
624 (back-to-indentation)
625 (looking-at (regexp-opt '(")" "]" "}"))))
626 python-indent-offset
627 0)))))))))
620 628
621(defun python-indent-calculate-levels () 629(defun python-indent-calculate-levels ()
622 "Calculate `python-indent-levels' and reset `python-indent-current-level'." 630 "Calculate `python-indent-levels' and reset `python-indent-current-level'."