Function: kill-ring-save
kill-ring-save is an interactive and byte-compiled function defined in
simple.el.gz.
Signature
(kill-ring-save BEG END &optional REGION)
Documentation
Save the region as if killed, but don't kill it.
In Transient Mark mode, deactivate the mark.
If interprogram-cut-function is non-nil, also save the text for a window
system cut and paste.
If you want to append the killed region to the last killed text,
use C-M-w (append-next-kill) before M-w (kill-ring-save).
The copied text is filtered by filter-buffer-substring before it is
saved in the kill ring, so the actual saved text might be different
from what was in the buffer.
When called from Lisp, save in the kill ring the stretch of text between BEG and END, unless the optional argument REGION is non-nil, in which case ignore BEG and END, and save the current region instead.
This command is similar to copy-region-as-kill, except that it gives
visual feedback indicating the extent of the region being copied.
Probably introduced at or before Emacs version 28.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/simple.el.gz
(defun kill-ring-save (beg end &optional region)
"Save the region as if killed, but don't kill it.
In Transient Mark mode, deactivate the mark.
If `interprogram-cut-function' is non-nil, also save the text for a window
system cut and paste.
If you want to append the killed region to the last killed text,
use \\[append-next-kill] before \\[kill-ring-save].
The copied text is filtered by `filter-buffer-substring' before it is
saved in the kill ring, so the actual saved text might be different
from what was in the buffer.
When called from Lisp, save in the kill ring the stretch of text
between BEG and END, unless the optional argument REGION is
non-nil, in which case ignore BEG and END, and save the current
region instead.
This command is similar to `copy-region-as-kill', except that it gives
visual feedback indicating the extent of the region being copied."
;; Pass mark first, then point, because the order matters when
;; calling `kill-append'.
(interactive (list (mark) (point) 'region))
(copy-region-as-kill beg end region)
;; This use of called-interactively-p is correct because the code it
;; controls just gives the user visual feedback.
(if (called-interactively-p 'interactive)
(indicate-copied-region)))