A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.gnu.org/software/emacs/manual/html_node/elisp/Writing-to-Files.html below:

Writing to Files (GNU Emacs Lisp Reference Manual)

This function writes the region delimited by start and end in the current buffer into the file specified by filename.

If start is nil, then the command writes the entire buffer contents (not just the accessible portion) to the file and ignores end.

If start is a string, then write-region writes or appends that string, rather than text from the buffer. end is ignored in this case.

If append is non-nil, then the specified text is appended to the existing file contents (if any). If append is a number, write-region seeks to that byte offset from the start of the file and writes the data from there.

If mustbenew is non-nil, then write-region asks for confirmation if filename names an existing file. If mustbenew is the symbol excl, then write-region does not ask for confirmation, but instead it signals an error file-already-exists if the file already exists. Although write-region normally follows a symbolic link and creates the pointed-to file if the symbolic link is dangling, it does not follow symbolic links if mustbenew is excl.

The test for an existing file, when mustbenew is excl, uses a special system feature. At least for files on a local disk, there is no chance that some other program could create a file of the same name before Emacs does, without Emacs’s noticing.

If visit is t, then Emacs establishes an association between the buffer and the file: the buffer is then visiting that file. It also sets the last file modification time for the current buffer to filename’s modtime, and marks the buffer as not modified. This feature is used by save-buffer, but you probably should not use it yourself.

If visit is a string, it specifies the file name to visit. This way, you can write the data to one file (filename) while recording the buffer as visiting another file (visit). The argument visit is used in the echo area message and also for file locking; visit is stored in buffer-file-name. This feature is used to implement file-precious-flag; don’t use it yourself unless you really know what you’re doing.

The optional argument lockname, if non-nil, specifies the file name to use for purposes of locking and unlocking, overriding filename and visit for that purpose.

The function write-region converts the data which it writes to the appropriate file formats specified by buffer-file-format and also calls the functions in the list write-region-annotate-functions. See File Format Conversion.

Normally, write-region displays the message ‘Wrote filename’ in the echo area. This message is inhibited if visit is neither t nor nil nor a string, or if Emacs is operating in batch mode (see Batch Mode). This feature is useful for programs that use files for internal purposes, files that the user does not need to know about.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4