Function: copy-to-register
copy-to-register is an interactive and byte-compiled function defined
in register.el.gz.
Signature
(copy-to-register REGISTER START END &optional DELETE-FLAG REGION)
Documentation
Copy region into register REGISTER.
With prefix arg, delete as well. Called from program, takes five args: REGISTER, START, END, DELETE-FLAG, and REGION. START and END are buffer positions indicating what to copy. The optional argument REGION if non-nil, indicates that we're not just copying some text between START and END, but we're copying the region.
Interactively, reads the register using register-read-with-preview.
Probably introduced at or before Emacs version 19.20.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/register.el.gz
(defun copy-to-register (register start end &optional delete-flag region)
"Copy region into register REGISTER.
With prefix arg, delete as well.
Called from program, takes five args: REGISTER, START, END, DELETE-FLAG,
and REGION. START and END are buffer positions indicating what to copy.
The optional argument REGION if non-nil, indicates that we're not just
copying some text between START and END, but we're copying the region.
Interactively, reads the register using `register-read-with-preview'."
(interactive (list (register-read-with-preview "Copy to register: ")
(region-beginning)
(region-end)
current-prefix-arg
t))
(set-register register (if region
(funcall region-extract-function delete-flag)
(prog1 (filter-buffer-substring start end)
(if delete-flag (delete-region start end)))))
(setq deactivate-mark t)
(cond (delete-flag)
((called-interactively-p 'interactive)
(indicate-copied-region))))