Function: diff-yank-function
diff-yank-function is a byte-compiled function defined in
diff-mode.el.gz.
Signature
(diff-yank-function TEXT)
Source Code
;; Defined in /usr/src/emacs/lisp/vc/diff-mode.el.gz
(defun diff-yank-function (text)
;; FIXME: the yank-handler is now called separately on each piece of text
;; with a yank-handler property, so the next-single-property-change call
;; below will always return nil :-( --stef
(let ((mixed (next-single-property-change 0 'yank-handler text))
(start (point)))
;; First insert the text.
(insert text)
;; If the text does not include any diff markers and if we're not
;; yanking back into a diff-mode buffer, get rid of the prefixes.
(unless (or mixed (derived-mode-p 'diff-mode))
(undo-boundary) ; Just in case the user wanted the prefixes.
(let ((re (save-excursion
(if (re-search-backward "^[><!][ \t]" start t)
(if (eq (char-after) ?!)
"^[!+- ][ \t]" "^[<>][ \t]")
"^[ <>!+-]"))))
(save-excursion
(while (re-search-backward re start t)
(replace-match "" t t)))))))