Function: python-indent-line

python-indent-line is a byte-compiled function defined in python.el.gz.

Signature

(python-indent-line &optional PREVIOUS)

Documentation

Internal implementation of python-indent-line-function.

Use the PREVIOUS level when argument is non-nil, otherwise indent to the maximum available level. When indentation is the minimum possible and PREVIOUS is non-nil, cycle back to the maximum level.

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/python.el.gz
(defun python-indent-line (&optional previous)
  "Internal implementation of `python-indent-line-function'.
Use the PREVIOUS level when argument is non-nil, otherwise indent
to the maximum available level.  When indentation is the minimum
possible and PREVIOUS is non-nil, cycle back to the maximum
level."
  (let ((follow-indentation-p
         ;; Check if point is within indentation.
         (and (<= (line-beginning-position) (point))
              (>= (+ (line-beginning-position)
                     (current-indentation))
                  (point)))))
    (save-excursion
      (indent-line-to
       (python-indent-calculate-indentation previous))
      (python-info-dedenter-opening-block-message))
    (when follow-indentation-p
      (back-to-indentation))))