Function: markdown--edit-indirect-after-commit-function

markdown--edit-indirect-after-commit-function is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown--edit-indirect-after-commit-function BEG END)

Documentation

Corrective logic run on code block content from lines BEG to END.

Restores code block indentation from BEG to END, and ensures trailing newlines at the END of code blocks.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown--edit-indirect-after-commit-function (beg end)
  "Corrective logic run on code block content from lines BEG to END.
Restores code block indentation from BEG to END, and ensures trailing newlines
at the END of code blocks."
  ;; ensure trailing newlines
  (goto-char end)
  (unless (eq (char-before) ?\n)
    (insert "\n"))
  ;; restore code block indentation
  (goto-char (- beg 1))
  (let ((block-indentation (current-indentation)))
    (when (> block-indentation 0)
      (indent-rigidly beg end block-indentation)))
  (font-lock-ensure))