# append-buffer(2)

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

## NAME

append-buffer - Write contents of buffer to end of named file

## SYNOPSIS

n append-buffer "file-name"

## DESCRIPTION

append-buffer is used to write the contents of the current buffer into an EXISTING file. Use save-buffer(2) if the buffer is to over-write the existing file already associated with the buffer. Use write-buffer(2) if the buffer is to be written out to a new file, or to replace an existing file.

append-buffer writes the contents of the current buffer to the named file file-name. But unlike write-buffer(2) the action of the write does not change the attributes associated with the file (if it exists), it also does not effect the stats of the current buffer.

On writing the file, append-buffer ignores the time(2m) and backup(2m) mode settings. The current buffer will not be time stamped and a backup will not be created for "file-name". If the buffer contains a narrow(2m) it will automatically be removed before saving so that the whole buffer is saved and restored when saving is complete

The argument n is a bit based flag, where:-

0x01

Enables validity checks (default). These include a check that the given file already exist, if not confirmation of writing is requested from the user. Without this flag the command will always succeed wherever possible. If "file-name" does not exist the buffer is written out in a similar fashion to using the command write-buffer(2).

0x02

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

0x04

Truncate the existing file before writing out the contents of the buffer. This means that the file will consist solely of the contents of the buffer, but it will still have the file attributes of the original file.

If n is not specified then the default argument of 1 is used.

## EXAMPLE

The following example appends the current buffer onto the end of a file, creating the file if it does not exists

    append-buffer "things_to_do.txt"

The following example truncates the users email file while maintaining the file attributes. This is taken from vm(3) where it is used to remove the current mail from the system mail box.

    find-buffer "*vm-empty-buffer"
    -1 buffer-mode "ctrlz"
    5 append-buffer %vm-mail-src
    delete-buffer $buffer-bname

Note that the macro ensures that ctrlz(2m) mode is removed. If it was enabled then the file written would not be empty.

## SEE ALSO

write-buffer(2), save-buffer(2).

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

</HMTL>