deuce.emacs.fileio
access-file
(access-file filename string)
Access file FILENAME, and get an error if that does not work.
The second argument STRING is used in the error message.
If there is no error, returns nil.
add-name-to-file
(add-name-to-file file newname & [ok-if-already-exists])
Give FILE additional name NEWNAME. Both args must be strings.
Signals a `file-already-exists' error if a file NEWNAME already exists
unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
A number as third arg means request confirmation if NEWNAME already exists.
This is what happens in interactive use with M-x.
car-less-than-car
(car-less-than-car a b)
Return t if (car A) is numerically less than (car B).
clear-buffer-auto-save-failure
(clear-buffer-auto-save-failure)
Clear any record of a recent auto-save failure in the current buffer.
clear-visited-file-modtime
(clear-visited-file-modtime)
Clear out records of last mod time of visited file.
Next attempt to save will certainly not complain of a discrepancy.
copy-file
(copy-file file newname & [ok-if-already-exists keep-time preserve-uid-gid preserve-selinux-context])
Copy FILE to NEWNAME. Both args must be strings.
If NEWNAME names a directory, copy FILE there.
This function always sets the file modes of the output file to match
the input file.
The optional third argument OK-IF-ALREADY-EXISTS specifies what to do
if file NEWNAME already exists. If OK-IF-ALREADY-EXISTS is nil, we
signal a `file-already-exists' error without overwriting. If
OK-IF-ALREADY-EXISTS is a number, we request confirmation from the user
about overwriting; this is what happens in interactive use with M-x.
Any other value for OK-IF-ALREADY-EXISTS means to overwrite the
existing file.
Fourth arg KEEP-TIME non-nil means give the output file the same
last-modified time as the old one. (This works on only some systems.)
A prefix arg makes KEEP-TIME non-nil.
If PRESERVE-UID-GID is non-nil, we try to transfer the
uid and gid of FILE to NEWNAME.
If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled
on the system, we copy the SELinux context of FILE to NEWNAME.
default-file-modes
(default-file-modes)
Return the default file protection for created files.
The value is an integer.
delete-directory-internal
(delete-directory-internal directory)
Delete the directory named DIRECTORY. Does not follow symlinks.
delete-file
(delete-file filename & [trash])
Delete file named FILENAME. If it is a symlink, remove the symlink.
If file has multiple names, it continues to exist with the other names.
TRASH non-nil means to trash the file instead of deleting, provided
`delete-by-moving-to-trash' is non-nil.
When called interactively, TRASH is t if no prefix argument is given.
With a prefix argument, TRASH is nil.
directory-file-name
(directory-file-name directory)
Returns the file name of the directory named DIRECTORY.
This is the name of the file that holds the data for the directory DIRECTORY.
This operation exists because a directory is also a file, but its name as
a directory is different from its name as a file.
In Unix-syntax, this function just removes the final slash.
do-auto-save
(do-auto-save & [no-message current-only])
Auto-save all buffers that need it.
This is all buffers that have auto-saving enabled
and are changed since last auto-saved.
Auto-saving writes the buffer into a file
so that your editing is not lost if the system crashes.
This file is not the file you visited; that changes only when you save.
Normally we run the normal hook `auto-save-hook' before saving.
A non-nil NO-MESSAGE argument means do not print any message if successful.
A non-nil CURRENT-ONLY argument means save only current buffer.
expand-file-name
(expand-file-name name & [default-directory])
Convert filename NAME to absolute, and canonicalize it.
Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative
(does not start with slash or tilde); if DEFAULT-DIRECTORY is nil or missing,
the current buffer's value of `default-directory' is used.
NAME should be a string that is a valid file name for the underlying
filesystem.
File name components that are `.' are removed, and
so are file name components followed by `..', along with the `..' itself;
note that these simplifications are done without checking the resulting
file names in the file system.
Multiple consecutive slashes are collapsed into a single slash,
except at the beginning of the file name when they are significant (e.g.,
UNC file names on MS-Windows.)
An initial `~/' expands to your home directory.
An initial `~USER/' expands to USER's home directory.
See also the function `substitute-in-file-name'.
For technical reasons, this function can return correct but
non-intuitive results for the root directory; for instance,
(expand-file-name ".." "/") returns "/..". For this reason, use
(directory-file-name (file-name-directory dirname)) to traverse a
filesystem tree, not (expand-file-name ".." dirname).
file-accessible-directory-p
(file-accessible-directory-p filename)
Return t if file FILENAME names a directory you can open.
For the value to be t, FILENAME must specify the name of a directory as a file,
and the directory must allow you to open files in it. In order to use a
directory as a buffer's current directory, this predicate must return true.
A directory name spec may be given instead; then the value is t
if the directory so specified exists and really is a readable and
searchable directory.
file-directory-p
(file-directory-p filename)
Return t if FILENAME names an existing directory.
Symbolic links to directories count as directories.
See `file-symlink-p' to distinguish symlinks.
file-executable-p
(file-executable-p filename)
Return t if FILENAME can be executed by you.
For a directory, this means you can access files in that directory.
file-exists-p
(file-exists-p filename)
Return t if file FILENAME exists (whether or not you can read it.)
See also `file-readable-p' and `file-attributes'.
This returns nil for a symlink to a nonexistent file.
Use `file-symlink-p' to test for such links.
file-modes
(file-modes filename)
Return mode bits of file named FILENAME, as an integer.
Return nil, if file does not exist or is not accessible.
file-name-absolute-p
(file-name-absolute-p filename)
Return t if file FILENAME specifies an absolute file name.
On Unix, this is a name starting with a `/' or a `~'.
file-name-as-directory
(file-name-as-directory file)
Return a string representing the file name FILE interpreted as a directory.
This operation exists because a directory is also a file, but its name as
a directory is different from its name as a file.
The result can be used as the value of `default-directory'
or passed as second argument to `expand-file-name'.
For a Unix-syntax file name, just appends a slash.
file-name-directory
(file-name-directory filename)
Return the directory component in file name FILENAME.
Return nil if FILENAME does not include a directory.
Otherwise return a directory name.
Given a Unix syntax file name, returns a string ending in slash.
file-name-nondirectory
(file-name-nondirectory filename)
Return file name FILENAME sans its directory.
For example, in a Unix-syntax file name,
this is everything after the last slash,
or the entire name if it contains no slash.
file-newer-than-file-p
(file-newer-than-file-p file1 file2)
Return t if file FILE1 is newer than file FILE2.
If FILE1 does not exist, the answer is nil;
otherwise, if FILE2 does not exist, the answer is t.
file-readable-p
(file-readable-p filename)
Return t if file FILENAME exists and you can read it.
See also `file-exists-p' and `file-attributes'.
file-regular-p
(file-regular-p filename)
Return t if FILENAME names a regular file.
This is the sort of file that holds an ordinary stream of data bytes.
Symbolic links to regular files count as regular files.
See `file-symlink-p' to distinguish symlinks.
file-selinux-context
(file-selinux-context filename)
Return SELinux context of file named FILENAME.
The return value is a list (USER ROLE TYPE RANGE), where the list
elements are strings naming the user, role, type, and range of the
file's SELinux security context.
Return (nil nil nil nil) if the file is nonexistent or inaccessible,
or if SELinux is disabled, or if Emacs lacks SELinux support.
file-symlink-p
(file-symlink-p filename)
Return non-nil if file FILENAME is the name of a symbolic link.
The value is the link target, as a string.
Otherwise it returns nil.
This function returns t when given the name of a symlink that
points to a nonexistent file.
file-writable-p
(file-writable-p filename)
Return t if file FILENAME can be written or created by you.
find-file-name-handler
(find-file-name-handler filename operation)
Return FILENAME's handler function for OPERATION, if it has one.
Otherwise, return nil.
A file name is handled if one of the regular expressions in
`file-name-handler-alist' matches it.
If OPERATION equals `inhibit-file-name-operation', then we ignore
any handlers that are members of `inhibit-file-name-handlers',
but we still do run any other handlers. This lets handlers
use the standard functions without calling themselves recursively.
insert-file-contents
(insert-file-contents filename & [visit beg end replace])
Insert contents of file FILENAME after point.
Returns list of absolute file name and number of characters inserted.
If second argument VISIT is non-nil, the buffer's visited filename and
last save file modtime are set, and it is marked unmodified. If
visiting and the file does not exist, visiting is completed before the
error is signaled.
The optional third and fourth arguments BEG and END specify what portion
of the file to insert. These arguments count bytes in the file, not
characters in the buffer. If VISIT is non-nil, BEG and END must be nil.
If optional fifth argument REPLACE is non-nil, replace the current
buffer contents (in the accessible portion) with the file contents.
This is better than simply deleting and inserting the whole thing
because (1) it preserves some marker positions and (2) it puts less data
in the undo list. When REPLACE is non-nil, the second return value is
the number of characters that replace previous buffer contents.
This function does code conversion according to the value of
`coding-system-for-read' or `file-coding-system-alist', and sets the
variable `last-coding-system-used' to the coding system actually used.
make-directory-internal
(make-directory-internal directory)
Create a new directory named DIRECTORY.
make-symbolic-link
(make-symbolic-link filename linkname & [ok-if-already-exists])
Make a symbolic link to FILENAME, named LINKNAME.
Both args must be strings.
Signals a `file-already-exists' error if a file LINKNAME already exists
unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
A number as third arg means request confirmation if LINKNAME already exists.
This happens for interactive use with M-x.
make-temp-name
(make-temp-name prefix)
Generate temporary file name (string) starting with PREFIX (a string).
The Emacs process number forms part of the result,
so there is no danger of generating a name being used by another process.
In addition, this function makes an attempt to choose a name
which has no existing file. To make this work,
PREFIX should be an absolute file name.
There is a race condition between calling `make-temp-name' and creating the
file which opens all kinds of security holes. For that reason, you should
probably use `make-temp-file' instead, except in three circumstances:
* If you are creating the file in the user's home directory.
* If you are creating a directory rather than an ordinary file.
* If you are taking special precautions as `make-temp-file' does.
next-read-file-uses-dialog-p
(next-read-file-uses-dialog-p)
Return t if a call to `read-file-name' will use a dialog.
The return value is only relevant for a call to `read-file-name' that happens
before any other event (mouse or keypress) is handled.
recent-auto-save-p
(recent-auto-save-p)
Return t if current buffer has been auto-saved recently.
More precisely, if it has been auto-saved since last read from or saved
in the visited file. If the buffer has no visited file,
then any auto-save counts as "recent".
rename-file
(rename-file file newname & [ok-if-already-exists])
Rename FILE as NEWNAME. Both args must be strings.
If file has names other than FILE, it continues to have those names.
Signals a `file-already-exists' error if a file NEWNAME already exists
unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.
A number as third arg means request confirmation if NEWNAME already exists.
This is what happens in interactive use with M-x.
set-buffer-auto-saved
(set-buffer-auto-saved)
Mark current buffer as auto-saved with its current text.
No auto-save file will be written until the buffer changes again.
set-default-file-modes
(set-default-file-modes mode)
Set the file permission bits for newly created files.
The argument MODE should be an integer; only the low 9 bits are used.
This setting is inherited by subprocesses.
set-file-modes
(set-file-modes filename mode)
Set mode bits of file named FILENAME to MODE (an integer).
Only the 12 low bits of MODE are used.
Interactively, mode bits are read by `read-file-modes', which accepts
symbolic notation, like the `chmod' command from GNU Coreutils.
set-file-selinux-context
(set-file-selinux-context filename context)
Set SELinux context of file named FILENAME to CONTEXT.
CONTEXT should be a list (USER ROLE TYPE RANGE), where the list
elements are strings naming the components of a SELinux context.
This function does nothing if SELinux is disabled, or if Emacs was not
compiled with SELinux support.
set-file-times
(set-file-times filename & [timestamp])
Set times of file FILENAME to TIMESTAMP.
Set both access and modification times.
Return t on success, else nil.
Use the current time if TIMESTAMP is nil. TIMESTAMP is in the format of
`current-time'.
set-visited-file-modtime
(set-visited-file-modtime & [time-list])
Update buffer's recorded modification time from the visited file's time.
Useful if the buffer was not read from the file normally
or if the file itself has been changed for some known benign reason.
An argument specifies the modification time value to use
(instead of that of the visited file), in the form of a list
(HIGH . LOW) or (HIGH LOW).
substitute-in-file-name
(substitute-in-file-name filename)
Substitute environment variables referred to in FILENAME.
`$FOO' where FOO is an environment variable name means to substitute
the value of that variable. The variable name should be terminated
with a character not a letter, digit or underscore; otherwise, enclose
the entire variable name in braces.
If `/~' appears, all of FILENAME through that `/' is discarded.
If `//' appears, everything up to and including the first of
those `/' is discarded.
unhandled-file-name-directory
(unhandled-file-name-directory filename)
Return a directly usable directory name somehow associated with FILENAME.
A `directly usable' directory name is one that may be used without the
intervention of any file handler.
If FILENAME is a directly usable file itself, return
(file-name-directory FILENAME).
If FILENAME refers to a file which is not accessible from a local process,
then this should return nil.
The `call-process' and `start-process' functions use this function to
get a current directory to run processes in.
unix-sync
(unix-sync)
Tell Unix to finish all pending disk updates.
verify-visited-file-modtime
(verify-visited-file-modtime & [buf])
Return t if last mod time of BUF's visited file matches what BUF records.
This means that the file has not been changed since it was visited or saved.
If BUF is omitted or nil, it defaults to the current buffer.
See Info node `(elisp)Modification Time' for more details.
visited-file-modtime
(visited-file-modtime)
Return the current buffer's recorded visited file modification time.
The value is a list of the form (HIGH LOW), like the time values that
`file-attributes' returns. If the current buffer has no recorded file
modification time, this function returns 0. If the visited file
doesn't exist, HIGH will be -1.
See Info node `(elisp)Modification Time' for more details.
write-region
(write-region start end filename & [append visit lockname mustbenew])
Write current region into specified file.
When called from a program, requires three arguments:
START, END and FILENAME. START and END are normally buffer positions
specifying the part of the buffer to write.
If START is nil, that means to use the entire buffer contents.
If START is a string, then output that string to the file
instead of any buffer contents; END is ignored.
Optional fourth argument APPEND if non-nil means
append to existing file contents (if any). If it is an integer,
seek to that offset in the file before writing.
Optional fifth argument VISIT, if t or a string, means
set the last-save-file-modtime of buffer to this file's modtime
and mark buffer not modified.
If VISIT is a string, it is a second file name;
the output goes to FILENAME, but the buffer is marked as visiting VISIT.
VISIT is also the file name to lock and unlock for clash detection.
If VISIT is neither t nor nil nor a string,
that means do not display the "Wrote file" message.
The optional sixth arg LOCKNAME, if non-nil, specifies the name to
use for locking and unlocking, overriding FILENAME and VISIT.
The optional seventh arg MUSTBENEW, if non-nil, insists on a check
for an existing file with the same name. If MUSTBENEW is `excl',
that means to get an error if the file already exists; never overwrite.
If MUSTBENEW is neither nil nor `excl', that means ask for
confirmation before overwriting, but do go ahead and overwrite the file
if the user confirms.
This does code conversion according to the value of
`coding-system-for-write', `buffer-file-coding-system', or
`file-coding-system-alist', and sets the variable
`last-coding-system-used' to the coding system actually used.
This calls `write-region-annotate-functions' at the start, and
`write-region-post-annotation-function' at the end.