Function: replace-preview--format
replace-preview--format is a byte-compiled function defined in
replace.el.gz.
Signature
(replace-preview--format MATCH REPLACEMENT)
Documentation
Return the string to show in place of MATCH, or nil for no preview.
MATCH is the matched string and REPLACEMENT is the string that would
replace it. They are combined as query-replace-show-preview says.
Source Code
;; Defined in /usr/src/emacs/lisp/replace.el.gz
(defun replace-preview--format (match replacement)
"Return the string to show in place of MATCH, or nil for no preview.
MATCH is the matched string and REPLACEMENT is the string that would
replace it. They are combined as `query-replace-show-preview' says."
(let ((s (save-match-data
(pcase query-replace-show-preview
('nil nil)
('replacement-only
(replace-preview-replacement-only match replacement))
('both
(replace-preview-both match replacement))
((pred functionp)
(funcall query-replace-show-preview match replacement))))))
(and (stringp s) s)))