# write-region(3)

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

## NAME

write-region - Write contents of region to named (new) file

## SYNOPSIS

n write-region "file-name"

## DESCRIPTION

write-region is used to write the contents of a selected region of a buffer to a NEW file i.e. where the region exists between point and mark.

write-buffer writes the contents of the current region to the named file file-name. The action of the write also changes the file name associated with the current buffer to the new file name.

On writing the region, if time(2m) mode is enabled then the time stamp string is searched for in the file and modified if located, to reflect the modification date and time.

If the region contains a narrow(2m) it will automatically be removed before saving so that the whole region is saved and restored when saving is complete.

The argument n may be used to change the default behavior of write-region described above, n is a bit based flag where:-

0x01

Enables validity checks (default). These include a check that the proposed file does not already exist, if so confirmation of writing is requested from the user. Also MicroEmacs 2009 checks all other current buffers for one with the proposed file name, if found, again confirmation is requested. Without this flag the command will always succeed wherever possible.

0x02

Disables the expansion of any narrows (see narrow-buffer(2)) before saving the buffer.

## NOTES

undo(2) information may be discarded when the file is written.

write-region is a macro defined in `misc.emf`, this macro was used as an example for Writing MicroEmacs Macros.

## SEE ALSO

append-buffer(2), save-buffer(2), write-buffer(2).
Writing MicroEmacs Macros.

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

</HMTL>