# read-file(2)

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

## NAME

read-file - Find and load file replacing current buffer

## SYNOPSIS

n read-file "file-name" (C-x C-r)

## DESCRIPTION

read-file operates like find-file(2), this command either finds the file in a buffer, or creates a new buffer and reads the file in. The command destroys the current buffer before the new buffer is created making this command ideal to use when the wrong file was entered on a find-file(2). This command is also useful for re-loading files that have changed on disk.

The numeric argument n can be used to modify the default behaviour of the command, where the bits are defined as follows:

0x01

If the file does not exist and this bit is not set the command fails at this point. If the file does not exist and this bit is set (or no argument is specified as the default argument is `1`) then a new empty buffer is created with the given file name, saving the buffer subsequently creates a new file.

0x02

If this bit is set the file will be loaded with binary(2m) mode enabled. See help on binary mode for more information on editing binary data files.

0x04

If this bit is set the file will be loaded with crypt(2m) mode enabled. See help on crypt mode for more information on editing encrypted files.

0x08

If this bit is set the file will be loaded with rbin(2m) mode enabled. See help on rbin mode for more information on efficient editing of binary data files.

0x10

If this bit is set then the file hook evaluation is not performed when the file is loaded (i.e. the buffer's file hook is not executed).

0x20

Disables loss of work checks, if this bit is set then the contents of the buffer is destroyed without any user prompts (useful in macros).

## SEE ALSO

reread-file(3), find-file(2), view-file(2), binary(2m), crypt(2m), rbin(2m).

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

</HMTL>