Function: markdown-promote-list-item

markdown-promote-list-item is an interactive and byte-compiled function defined in markdown-mode.el.

Signature

(markdown-promote-list-item &optional BOUNDS)

Documentation

Unindent (or promote) the current list item.

Optionally, BOUNDS of the current list item may be provided if available. In nested lists, demote child items as well.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-promote-list-item (&optional bounds)
  "Unindent (or promote) the current list item.
Optionally, BOUNDS of the current list item may be provided if available.
In nested lists, demote child items as well."
  (interactive)
  (when (or bounds (setq bounds (markdown-cur-list-item-bounds)))
    (save-excursion
      (save-match-data
        (let ((item-start (set-marker (make-marker) (nth 0 bounds)))
              (item-end (set-marker (make-marker) (nth 1 bounds)))
              (list-start (progn (markdown-beginning-of-list)
                                 (set-marker (make-marker) (point))))
              (list-end (progn (markdown-end-of-list)
                               (set-marker (make-marker) (point))))
              num regexp)
          (goto-char item-start)
          (when (looking-at (format "^[ ]\\{1,%d\\}"
                                    markdown-list-indent-width))
            (setq num (- (match-end 0) (match-beginning 0)))
            (setq regexp (format "^[ ]\\{1,%d\\}" num))
            (while (and (< (point) item-end)
                        (re-search-forward regexp item-end t))
              (replace-match "" nil nil)
              (forward-line))
            (markdown-syntax-propertize-list-items list-start list-end)))))))