Function: markdown-indent-line

markdown-indent-line is an interactive and byte-compiled function defined in markdown-mode.el.

Signature

(markdown-indent-line)

Documentation

Indent the current line using some heuristics.

If the _previous_ command was either markdown-enter-key or markdown-cycle, then we should cycle to the next reasonable indentation position. Otherwise, we could have been called directly by markdown-enter-key, by an initial call of markdown-cycle, or indirectly by auto-fill-mode. In these cases, indent to the default position. Positions are calculated by markdown-calc-indents.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-indent-line ()
  "Indent the current line using some heuristics.
If the _previous_ command was either `markdown-enter-key' or
`markdown-cycle', then we should cycle to the next
reasonable indentation position.  Otherwise, we could have been
called directly by `markdown-enter-key', by an initial call of
`markdown-cycle', or indirectly by `auto-fill-mode'.  In
these cases, indent to the default position.
Positions are calculated by `markdown-calc-indents'."
  (interactive)
  (let ((positions (markdown-calc-indents))
        (point-pos (current-column))
        (_ (back-to-indentation))
        (cur-pos (current-column)))
    (if (not (equal this-command 'markdown-cycle))
        (indent-line-to (car positions))
      (setq positions (sort (delete-dups positions) '<))
      (let* ((next-pos (markdown-indent-find-next-position cur-pos positions))
             (new-point-pos (max (+ point-pos (- next-pos cur-pos)) 0)))
        (indent-line-to next-pos)
        (move-to-column new-point-pos)))))