Function: markdown-outdent-or-delete

markdown-outdent-or-delete is an interactive and byte-compiled function defined in markdown-mode.el.

Signature

(markdown-outdent-or-delete ARG)

Documentation

Handle BACKSPACE by cycling through indentation points.

When BACKSPACE is pressed, if there is only whitespace before the current point, then outdent the line one level. Otherwise, do normal delete by repeating backward-delete-char-untabify ARG times.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-outdent-or-delete (arg)
  "Handle BACKSPACE by cycling through indentation points.
When BACKSPACE is pressed, if there is only whitespace
before the current point, then outdent the line one level.
Otherwise, do normal delete by repeating
`backward-delete-char-untabify' ARG times."
  (interactive "*p")
  (if (use-region-p)
      (backward-delete-char-untabify arg)
    (let ((cur-pos (current-column))
          (start-of-indention (save-excursion
                                (back-to-indentation)
                                (current-column)))
          (positions (markdown-calc-indents)))
      (if (and (> cur-pos 0) (= cur-pos start-of-indention))
          (indent-line-to (markdown-outdent-find-next-position cur-pos positions))
        (backward-delete-char-untabify arg)))))