Function: yaml-indent-line

yaml-indent-line is an interactive and natively compiled function defined in yaml-mode.el.

Signature

(yaml-indent-line)

Documentation

Indent the current line.

The first time this command is used, the line will be indented to the maximum sensible indentation. Each immediately subsequent usage will back-dent the line by yaml-indent-offset spaces. On reaching column
0, it will cycle back to the maximum sensible indentation.

Key Bindings

This command is not in any keymaps.

Source Code

;; Defined in /nix/store/fxfawcfn8g3mqnf4q0lmvgvy0vp3nxrx-emacs-packages-deps/share/emacs/site-lisp/elpa/yaml-mode-20260830.2340/yaml-mode.el
(defun yaml-indent-line ()
  "Indent the current line.
The first time this command is used, the line will be indented to the
maximum sensible indentation.  Each immediately subsequent usage will
back-dent the line by `yaml-indent-offset' spaces.  On reaching column
0, it will cycle back to the maximum sensible indentation."
  (interactive "*")
  (let ((ci (current-indentation))
        (need (yaml-compute-indentation)))
    (save-excursion
      (if (and (equal last-command this-command) (/= ci 0))
          (indent-line-to (* (/ (- ci 1) yaml-indent-offset) yaml-indent-offset))
        (indent-line-to need)))
    (if (< (current-column) (current-indentation))
        (forward-to-indentation 0))))