Function: insert-for-yank

insert-for-yank is a byte-compiled function defined in subr.el.gz.

Signature

(insert-for-yank STRING)

Documentation

Insert STRING at point for the yank command.

This function is like insert, except it honors the variables yank-handled-properties and yank-excluded-properties, and the yank-handler text property, in the way that yank does.

It also runs the string through yank-transform-functions.

View in manual

Probably introduced at or before Emacs version 22.1.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun insert-for-yank (string)
  "Insert STRING at point for the `yank' command.

This function is like `insert', except it honors the variables
`yank-handled-properties' and `yank-excluded-properties', and the
`yank-handler' text property, in the way that `yank' does.

It also runs the string through `yank-transform-functions'."
  ;; Allow altering the yank string.
  (run-hook-wrapped 'yank-transform-functions
                    (lambda (f) (setq string (funcall f string)) nil))
  (let (to)
    (while (setq to (next-single-property-change 0 'yank-handler string))
      (insert-for-yank-1 (substring string 0 to))
      (setq string (substring string to))))
  (insert-for-yank-1 string))