Go to the first, previous, next, last section, table of contents.
-
The new function
file-accessible-directory-p
tells you whether
you can open files in a particular directory. Specify as an argument
either a directory name or a file name which names a directory file.
The function returns t
if you can open existing files in that
directory.
-
The new function
file-executable-p
returns t
if its
argument is the name of a file you have permission to execute.
-
The function
file-truename
returns the "true name" of a
specified file. This is the name that you get by following symbolic
links until none remain. The argument must be an absolute file name.
-
New functions
make-directory
and delete-directory
create and
delete directories. They both take one argument, which is the name of
the directory as a file.
-
The function
read-file-name
now takes an additional argument
which specifies an initial file name. If you specify this argument,
read-file-name
inserts it along with the directory name. It puts
the cursor between the directory and the initial file name.
The user can then use the initial file name unchanged, modify it, or
simply kill it with C-k.
If the variable insert-default-directory
is nil
, then the
default directory is not inserted, and the new argument is ignored.
-
The function
file-relative-name
does the inverse of
expansion--it tries to return a relative name which is equivalent to
filename when interpreted relative to directory. (If such a
relative name would be longer than the absolute name, it returns the
absolute name instead.)
-
The function
file-newest-backup
returns the name of the most
recent backup file for filename, or nil
that file has no
backup files.
-
The list returned by
file-attributes
now has 12 elements. The
12th element is the file system number of the file system that the file
is in. This element together with the file's inode number, which is the
11th element, give enough information to distinguish any two files on
the system--no two files can have the same values for both of these
numbers.
-
The new function
set-visited-file-modtime
updates the current
buffer's recorded modification time from the visited file's time.
This is useful if the buffer was not read from the file normally, or
if the file itself has been changed for some known benign reason.
If you give the function an argument, that argument specifies the new
value for the recorded modification time. The argument should be a list
of the form (high . low)
or (high
low)
containing two integers, each of which holds 16 bits of the
time. (This is the same format that file-attributes
uses to
return time values.)
The new function visited-file-modtime
returns the recorded last
modification time, in that same format.
-
The function
directory-files
now takes an optional fourth
argument which, if non-nil
, inhibits sorting the file names.
Use this if you want the utmost possible speed and don't care what order
the files are processed in.
If the order of processing is at all visible to the user, then the user
will probably be happier if you do sort the names.
-
The variable
directory-abbrev-alist
contains an alist of
abbreviations to use for file directories. Each element has the form
(from . to)
, and says to replace from with
to when it appears in a directory name. This replacement is done
when setting up the default directory of a newly visited file. The
from string is actually a regular expression; it should always
start with `^'.
You can set this variable in `site-init.el' to describe the
abbreviations appropriate for your site.
-
The function
abbreviate-file-name
applies abbreviations from
directory-abbrev-alist
to its argument, and substitutes `~'
for the user's home directory.
Abbreviated directory names are useful for directories that are normally
accessed through symbolic links. If you think of the link's name as
"the name" of the directory, you can define it as an abbreviation for
the directory's official name; then ordinarily Emacs will call that
directory by the link name you normally use.
-
write-region
can write a given string instead of text from the
buffer. Use the string as the first argument (in place of the
starting character position).
You can supply a second file name as the fifth argument (visit).
Use this to write the data to one file (the first argument,
filename) while nominally visiting a different file (the fifth
argument, visit). The argument visit is used in the echo
area message and also for file locking; visit is stored in
buffer-file-name
.
-
The value of
write-file-hooks
does not change when you switch to
a new major mode. The intention is that these hooks have to do with
where the file came from, and not with what it contains.
-
There is a new hook variable for saving files:
write-contents-hooks
. It works just like write-file-hooks
except that switching to a new major mode clears it back to nil
.
Major modes should use this hook variable rather than
write-file-hooks
.
-
The hook
after-save-buffer-hook
runs just after a buffer has been
saved in its visited file.
-
The new function
set-default-file-modes
sets the file protection
for new files created with Emacs. The argument must be an integer. (It
would be better to permit symbolic arguments like the chmod
program, but that would take more work than this function merits.)
Use the new function default-file-modes
to read the current
default file mode.
-
Call the new function
unix-sync
to force all pending disk output
to happen as soon as possible.
Go to the first, previous, next, last section, table of contents.