Function: yank-from-kill-ring
yank-from-kill-ring is an interactive and byte-compiled function
defined in simple.el.gz.
Signature
(yank-from-kill-ring STRING &optional ARG)
Documentation
Select a stretch of previously killed text and insert ("paste") it.
This command allows you to select one of the stretches of text
killed or yanked by previous commands, which are recorded in
kill-ring, and reinsert the chosen kill at point.
This command prompts for a previously-killed text in the minibuffer.
Use the minibuffer history and search commands, or the minibuffer
completion commands, to select a previously-killed text. In
particular, typing TAB (minibuffer-complete) at the prompt will pop up a buffer showing
all the previously-killed stretches of text from which you can
choose the one you want to reinsert.
Once you select the text you want to reinsert, type RET (exit-minibuffer) to actually
insert it and exit the minibuffer.
You can also edit the selected text in the minibuffer before
inserting it.
With C-u (universal-argument) as argument, this command puts point at
beginning of the inserted text and mark at the end, like yank does.
When called from Lisp, insert STRING like insert-for-yank does.
Probably introduced at or before Emacs version 28.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun yank-from-kill-ring (string &optional arg)
"Select a stretch of previously killed text and insert (\"paste\") it.
This command allows you to select one of the stretches of text
killed or yanked by previous commands, which are recorded in
`kill-ring', and reinsert the chosen kill at point.
This command prompts for a previously-killed text in the minibuffer.
Use the minibuffer history and search commands, or the minibuffer
completion commands, to select a previously-killed text. In
particular, typing \\<minibuffer-local-completion-map>\\[minibuffer-complete] at the prompt will pop up a buffer showing
all the previously-killed stretches of text from which you can
choose the one you want to reinsert.
Once you select the text you want to reinsert, type \\<minibuffer-local-map>\\[exit-minibuffer] to actually
insert it and exit the minibuffer.
You can also edit the selected text in the minibuffer before
inserting it.
With \\[universal-argument] as argument, this command puts point at
beginning of the inserted text and mark at the end, like `yank' does.
When called from Lisp, insert STRING like `insert-for-yank' does."
(interactive (list (read-from-kill-ring "Yank from kill-ring: ")
current-prefix-arg))
(setq yank-window-start (window-start))
(push-mark)
(insert-for-yank string)
(when yank-from-kill-ring-rotate
(let ((pos (seq-position kill-ring string)))
(if pos
(setq kill-ring-yank-pointer (nthcdr pos kill-ring))
(kill-new string))))
(if (consp arg)
;; Swap point and mark like in `yank' and `yank-pop'.
(goto-char (prog1 (mark t)
(set-marker (mark-marker) (point) (current-buffer))))))