Function: markdown-unwrap-things-in-region

markdown-unwrap-things-in-region is a byte-compiled function defined in markdown-mode.el.

Signature

(markdown-unwrap-things-in-region BEG END REGEXP ALL TEXT)

Documentation

Remove prefix and suffix of all things in region from BEG to END.

When a thing in the region matches REGEXP, replace the subexpression ALL with the string in subexpression TEXT. Return a cons cell containing updated bounds for the region.

Source Code

;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-unwrap-things-in-region (beg end regexp all text)
  "Remove prefix and suffix of all things in region from BEG to END.
When a thing in the region matches REGEXP, replace the
subexpression ALL with the string in subexpression TEXT.
Return a cons cell containing updated bounds for the region."
  (save-excursion
    (goto-char beg)
    (let ((removed 0) len-all len-text)
      (while (re-search-forward regexp (- end removed) t)
        (setq len-all (length (match-string-no-properties all)))
        (setq len-text (length (match-string-no-properties text)))
        (setq removed (+ removed (- len-all len-text)))
        (replace-match (match-string text) t t nil all))
      (cons beg (- end removed)))))