diff options
Diffstat (limited to 'doc/lispref/files.texi')
-rw-r--r-- | doc/lispref/files.texi | 77 |
1 files changed, 58 insertions, 19 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index fd4b9a7bc5f..9e7aeeecec8 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -582,11 +582,12 @@ contents and inserting the whole file, because (1) it preserves some marker positions and (2) it puts less data in the undo list. It is possible to read a special file (such as a FIFO or an I/O -device) with @code{insert-file-contents}, as long as @var{replace}, -and @var{visit} and @var{beg} are @code{nil}. However, you should -normally use an @var{end} argument for these files to avoid inserting -(potentially) unlimited data into the buffer (for instance, when -inserting data from @file{/dev/urandom}). +device) with @code{insert-file-contents}, as long as @var{replace} is +@code{nil} or @code{if-regular}, and @var{visit} and @var{beg} are +@code{nil}. However, you should normally use an @var{end} argument +for these files to avoid inserting (potentially) unlimited data into +the buffer (for instance, when inserting data from +@file{/dev/urandom}). @end defun @defun insert-file-contents-literally filename &optional visit beg end replace @@ -692,11 +693,9 @@ files that the user does not need to know about. @defvar write-region-inhibit-fsync If this variable's value is @code{nil}, @code{write-region} uses the -@code{fsync} system call after writing a file. Although this slows -Emacs down, it lessens the risk of data loss after power failure. If -the value is @code{t}, Emacs does not use @code{fsync}. The default -value is @code{nil} when Emacs is interactive, and @code{t} when Emacs -runs in batch mode. @xref{Files and Storage}. +@code{fsync} system call after writing a file. If the value is +@code{t}, Emacs does not use @code{fsync}. The default value is +@code{t}. @xref{Files and Storage}. @end defvar @defmac with-temp-file file body@dots{} @@ -971,9 +970,16 @@ guaranteed to be writable. @end defmac @defun access-file filename string +@vindex remote-file-name-access-timeout If you can read @var{filename} this function returns @code{nil}; otherwise it signals an error using @var{string} as the error message text. + +If the user option @code{remote-file-name-access-timeout} is a +positive number, the function signals an error when it doesn't finish +after that time (in seconds). This applies only to remote files, and +only when there is no additional time spent while reading passwords or +alike. @end defun @defun file-ownership-preserved-p filename &optional group @@ -1880,6 +1886,11 @@ no prefix argument is given, and @code{nil} otherwise. See also @code{delete-directory} in @ref{Create/Delete Dirs}. @end deffn +@defopt remote-file-name-inhibit-delete-by-moving-to-trash +If this variable is non-@code{nil}, remote files are never moved to +the Trash. They are deleted instead. +@end defopt + @cindex file permissions, setting @cindex permissions, file @cindex file modes, setting @@ -2049,17 +2060,28 @@ data already stored elsewhere on secondary storage until one file or the other is later modified; this will lose both files if the only copy on secondary storage is lost due to media failure. Second, the operating system might not write data to secondary storage -immediately, which will lose the data if power is lost. +immediately, which will lose the data if power is lost +or if there is a media failure. @findex write-region Although both sorts of failures can largely be avoided by a suitably -configured file system, such systems are typically more expensive or -less efficient. In more-typical systems, to survive media failure you +configured system, such systems are typically more expensive or +less efficient. In lower-end systems, to survive media failure you can copy the file to a different device, and to survive a power -failure you can use the @code{write-region} function with the +failure (or be immediately notified of a media failure) you can use +the @code{write-region} function with the @code{write-region-inhibit-fsync} variable set to @code{nil}. +Although this variable is ordinarily @code{t} because that can +significantly improve performance, it may make sense to temporarily +bind it to @code{nil} if using Emacs to implement database-like +transactions that survive power failure on lower-end systems. @xref{Writing to Files}. +On some platforms when Emacs changes a file other processes might not +be notified of the change immediately. Setting +@code{write-region-inhibit-fsync} to @code{nil} may improve +notification speed in this case, though there are no guarantees. + @node File Names @section File Names @cindex file names @@ -3377,7 +3399,7 @@ first, before handlers for jobs such as remote file access. @code{file-directory-p}, @code{file-equal-p}, @code{file-executable-p}, @code{file-exists-p}, -@code{file-in-directory-p}, +@code{file-group-gid}, @code{file-in-directory-p}, @code{file-local-copy}, @code{file-locked-p}, @code{file-modes}, @code{file-name-all-completions}, @code{file-name-as-directory}, @@ -3392,7 +3414,8 @@ first, before handlers for jobs such as remote file access. @code{file-readable-p}, @code{file-regular-p}, @code{file-remote-p}, @code{file-selinux-context}, @code{file-symlink-p}, @code{file-system-info}, -@code{file-truename}, @code{file-writable-p}, +@code{file-truename}, @code{file-user-uid}, +@code{file-writable-p}, @code{find-backup-file-name},@* @code{get-file-buffer}, @code{insert-directory}, @@ -3438,7 +3461,7 @@ first, before handlers for jobs such as remote file access. @code{file-direc@discretionary{}{}{}tory-p}, @code{file-equal-p}, @code{file-executable-p}, @code{file-exists-p}, -@code{file-in-directory-p}, +@code{file-group-gid}, @code{file-in-directory-p}, @code{file-local-copy}, @code{file-locked-p}, @code{file-modes}, @code{file-name-all-completions}, @code{file-name-as-directory}, @@ -3453,7 +3476,8 @@ first, before handlers for jobs such as remote file access. @code{file-readable-p}, @code{file-regular-p}, @code{file-remote-p}, @code{file-selinux-context}, @code{file-symlink-p}, @code{file-system-info}, -@code{file-truename}, @code{file-writable-p}, +@code{file-truename}, @code{file-user-uid}, +@code{file-writable-p}, @code{find-backup-file-name}, @code{get-file-buffer}, @code{insert-directory}, @@ -3608,7 +3632,11 @@ be @code{root}. If @var{connected} is non-@code{nil}, this function returns @code{nil} even if @var{filename} is remote, if Emacs has no network connection to its host. This is useful when you want to avoid the delay of -making connections when they don't exist. +making connections when they don't exist. If @var{connected} is +@code{never}, @emph{never} use an existing connection to return the +identification, even if one is already present (this is otherwise like +a value of @code{nil}). This lets you prevent any connection-specific +logic, such as expanding the local part of the file name. @end defun @defun unhandled-file-name-directory filename @@ -3672,6 +3700,17 @@ between consecutive checks. For example: @end example @end defopt +@defmac without-remote-files body@dots{} +The @code{without-remote-files} macro evaluates the @var{body} forms +with deactivated file name handlers for remote files. Those file +names would be handled literally. + +The macro should be used only in forms where it is obvious, that +remote files cannot appear or where it is intended not to handle +remote file names. It also reduces checks with +@code{file-name-handler-alist}, resulting in more performant code. +@end defmac + @node Format Conversion @section File Format Conversion |