Function: markdown-unwrap-thing-at-point
markdown-unwrap-thing-at-point is a byte-compiled function defined in
markdown-mode.el.
Signature
(markdown-unwrap-thing-at-point REGEXP ALL TEXT)
Documentation
Remove prefix and suffix of thing at point and reposition the point.
When the thing at point matches REGEXP, replace the subexpression ALL with the string in subexpression TEXT. Reposition the point in an appropriate location accounting for the removal of prefix and suffix strings. Return new bounds of string from group TEXT. When REGEXP is nil, assumes match data is already set.
Source Code
;; Defined in ~/.emacs.d/elpa/markdown-mode-20260321.143/markdown-mode.el
(defun markdown-unwrap-thing-at-point (regexp all text)
"Remove prefix and suffix of thing at point and reposition the point.
When the thing at point matches REGEXP, replace the subexpression
ALL with the string in subexpression TEXT. Reposition the point
in an appropriate location accounting for the removal of prefix
and suffix strings. Return new bounds of string from group TEXT.
When REGEXP is nil, assumes match data is already set."
(when (or (null regexp)
(thing-at-point-looking-at regexp))
(let ((cur (point))
(prefix (cons (match-beginning all) (match-beginning text)))
(suffix (cons (match-end text) (match-end all)))
(bounds (cons (match-beginning text) (match-end text))))
;; Replace the thing at point
(replace-match (match-string text) t t nil all)
;; Reposition the point
(goto-char (markdown-point-after-unwrap cur prefix suffix))
;; Adjust bounds
(setq bounds (cons (car prefix)
(- (cdr bounds) (- (cdr prefix) (car prefix))))))))