# copy-region(2)

[Home] [Commands] [Variables] [Macro-Dev] [Glossary]

## NAME

copy-region - Copy a region of the buffer

## SYNOPSIS

n copy-region (esc w)

## DESCRIPTION

copy-region copies all the characters between the cursor and the mark set with the set-mark(2) command into the kill buffer (so they can later be yanked elsewhere).

If the last command also entered text into the kill buffer (or the @cl(4) variable is set to one of these commands) the copy-region text is appended to the last kill.

The numeric argument n determines how the copy operates when a narrow region, defined by narrow-buffer(2), is encountered. The default operation, when the number argument is `1`, is to copy all of the text contained within the narrowed region. When the numeric argument is `0` then narrowed region is NOT copied and the text is copied as it appears in the buffer.

## USAGE

To copy text from one place to another, using the copy-region command, the following operations are performed:

- Move to the beginning of the text you want to copy.
- Set the mark there with the set-mark (esc-space) command.
- Move the point (cursor) to the end of the text.
- Use copy-region to copy the region you just defined. The text will be saved in the kill buffer. (If you accidentally delete the text use yank (C-y) immediately or undo (C-x u) to restore the text).
- Move the point to the place you want the text to appear.
- Use the yank (C-y) command to copy the text from the kill buffer to the current point.

Repeat the last two steps to insert further copies of the same text.

## NOTES

Windowing systems such as X-Windows and Microsoft Windows utilize a global windowing kill buffer allowing data to be moved between windowing applications (cut buffer and clipboard, respectively). Within these environments MicroEmacs 2009 automatically interacts with the windowing systems kill buffer, the last MicroEmacs 2009 copy-region entry is immediately available for a paste operation into another windowing application.

The numeric argument n was introduced in the '04 release.

## SEE ALSO

exchange-point-and-mark(2), kill-region(2), narrow-buffer(2), set-mark(2), yank(2).

(c) Copyright JASSPA 2009
Last Modified: 2009/08/29
Generated On: 2009/10/12

</HMTL>