1 |
@c -*-texinfo-*- |
@c -*-texinfo-*- |
2 |
@c This is part of the GNU Emacs Lisp Reference Manual. |
@c This is part of the GNU Emacs Lisp Reference Manual. |
3 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 |
@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 |
4 |
@c Free Software Foundation, Inc. |
@c Free Software Foundation, Inc. |
5 |
@c See the file elisp.texi for copying conditions. |
@c See the file elisp.texi for copying conditions. |
6 |
@setfilename ../info/files |
@setfilename ../info/files |
7 |
@node Files, Backups and Auto-Saving, Documentation, Top |
@node Files, Backups and Auto-Saving, Documentation, Top |
92 |
|
|
93 |
@deffn Command find-file filename &optional wildcards |
@deffn Command find-file filename &optional wildcards |
94 |
This command selects a buffer visiting the file @var{filename}, |
This command selects a buffer visiting the file @var{filename}, |
95 |
using an existing buffer if there is one, and otherwise creating a |
using an existing buffer if there is one, and otherwise creating a |
96 |
new buffer and reading the file into it. It also returns that buffer. |
new buffer and reading the file into it. It also returns that buffer. |
97 |
|
|
98 |
The body of the @code{find-file} function is very simple and looks |
The body of the @code{find-file} function is very simple and looks |
141 |
Visiting}). That function sets the buffer major mode, parses local |
Visiting}). That function sets the buffer major mode, parses local |
142 |
variables, warns the user if there exists an auto-save file more recent |
variables, warns the user if there exists an auto-save file more recent |
143 |
than the file just visited, and finishes by running the functions in |
than the file just visited, and finishes by running the functions in |
144 |
@code{find-file-hooks}. |
@code{find-file-hook}. |
145 |
|
|
146 |
If the optional argument @var{rawfile} is non-@code{nil}, then |
If the optional argument @var{rawfile} is non-@code{nil}, then |
147 |
@code{after-find-file} is not called, and the |
@code{after-find-file} is not called, and the |
148 |
@code{find-file-not-found-hooks} are not run in case of failure. What's |
@code{find-file-not-found-functions} are not run in case of failure. What's |
149 |
more, a non-@code{nil} @var{rawfile} value suppresses coding system |
more, a non-@code{nil} @var{rawfile} value suppresses coding system |
150 |
conversion (@pxref{Coding Systems}) and format conversion (@pxref{Format |
conversion (@pxref{Coding Systems}) and format conversion (@pxref{Format |
151 |
Conversion}). |
Conversion}). |
200 |
not treated specially. |
not treated specially. |
201 |
@end defvar |
@end defvar |
202 |
|
|
203 |
@defvar find-file-hooks |
@defvar find-file-hook |
204 |
The value of this variable is a list of functions to be called after a |
The value of this variable is a list of functions to be called after a |
205 |
file is visited. The file's local-variables specification (if any) will |
file is visited. The file's local-variables specification (if any) will |
206 |
have been processed before the hooks are run. The buffer visiting the |
have been processed before the hooks are run. The buffer visiting the |
210 |
it would not be advisable. @xref{Hooks}. |
it would not be advisable. @xref{Hooks}. |
211 |
@end defvar |
@end defvar |
212 |
|
|
213 |
@defvar find-file-not-found-hooks |
@defvar find-file-not-found-functions |
214 |
The value of this variable is a list of functions to be called when |
The value of this variable is a list of functions to be called when |
215 |
@code{find-file} or @code{find-file-noselect} is passed a nonexistent |
@code{find-file} or @code{find-file-noselect} is passed a nonexistent |
216 |
file name. @code{find-file-noselect} calls these functions as soon as |
file name. @code{find-file-noselect} calls these functions as soon as |
285 |
|
|
286 |
If @var{nomodes} is non-@code{nil}, that means don't alter the buffer's |
If @var{nomodes} is non-@code{nil}, that means don't alter the buffer's |
287 |
major mode, don't process local variables specifications in the file, |
major mode, don't process local variables specifications in the file, |
288 |
and don't run @code{find-file-hooks}. This feature is used by |
and don't run @code{find-file-hook}. This feature is used by |
289 |
@code{revert-buffer} in some cases. |
@code{revert-buffer} in some cases. |
290 |
|
|
291 |
The last thing @code{after-find-file} does is call all the functions |
The last thing @code{after-find-file} does is call all the functions |
292 |
in the list @code{find-file-hooks}. |
in the list @code{find-file-hook}. |
293 |
@end defun |
@end defun |
294 |
|
|
295 |
@node Saving Buffers |
@node Saving Buffers |
362 |
conversion (@pxref{Format Conversion}), and may save text properties in |
conversion (@pxref{Format Conversion}), and may save text properties in |
363 |
``annotations'' (@pxref{Saving Properties}). |
``annotations'' (@pxref{Saving Properties}). |
364 |
|
|
365 |
@defvar write-file-hooks |
@defvar write-file-functions |
366 |
The value of this variable is a list of functions to be called before |
The value of this variable is a list of functions to be called before |
367 |
writing out a buffer to its visited file. If one of them returns |
writing out a buffer to its visited file. If one of them returns |
368 |
non-@code{nil}, the file is considered already written and the rest of |
non-@code{nil}, the file is considered already written and the rest of |
369 |
the functions are not called, nor is the usual code for writing the file |
the functions are not called, nor is the usual code for writing the file |
370 |
executed. |
executed. |
371 |
|
|
372 |
If a function in @code{write-file-hooks} returns non-@code{nil}, it |
If a function in @code{write-file-functions} returns non-@code{nil}, it |
373 |
is responsible for making a backup file (if that is appropriate). |
is responsible for making a backup file (if that is appropriate). |
374 |
To do so, execute the following code: |
To do so, execute the following code: |
375 |
|
|
381 |
@code{backup-buffer} and use that to set the mode bits of the file that |
@code{backup-buffer} and use that to set the mode bits of the file that |
382 |
you write. This is what @code{save-buffer} normally does. |
you write. This is what @code{save-buffer} normally does. |
383 |
|
|
384 |
The hook functions in @code{write-file-hooks} are also responsible for |
The hook functions in @code{write-file-functions} are also responsible for |
385 |
encoding the data (if desired): they must choose a suitable coding |
encoding the data (if desired): they must choose a suitable coding |
386 |
system (@pxref{Lisp and Coding Systems}), perform the encoding |
system (@pxref{Lisp and Coding Systems}), perform the encoding |
387 |
(@pxref{Explicit Encoding}), and set @code{last-coding-system-used} to |
(@pxref{Explicit Encoding}), and set @code{last-coding-system-used} to |
388 |
the coding system that was used (@pxref{Encoding and I/O}). |
the coding system that was used (@pxref{Encoding and I/O}). |
389 |
|
|
390 |
Do not make this variable buffer-local. To set up buffer-specific hook |
If you set this hook locally in a buffer, it is assumed to be |
391 |
functions, use @code{write-contents-hooks} instead. |
associated with the file or the way the contents of the buffer were |
392 |
|
obtained. Thus the variable is marked as a permanent local, so that |
393 |
|
changing the major mode does not alter a buffer-local value. On the |
394 |
|
other hand, calling @code{set-visited-file-name} will reset it. |
395 |
|
If this is not what you want, you might like to use |
396 |
|
@code{write-contents-functions} instead. |
397 |
|
|
398 |
Even though this is not a normal hook, you can use @code{add-hook} and |
Even though this is not a normal hook, you can use @code{add-hook} and |
399 |
@code{remove-hook} to manipulate the list. @xref{Hooks}. |
@code{remove-hook} to manipulate the list. @xref{Hooks}. |
400 |
@end defvar |
@end defvar |
401 |
|
|
402 |
@c Emacs 19 feature |
@c Emacs 19 feature |
403 |
@defvar local-write-file-hooks |
@defvar write-contents-functions |
404 |
This works just like @code{write-file-hooks}, but it is intended to be |
This works just like @code{write-file-functions}, but it is intended for |
|
made buffer-local in particular buffers, and used for hooks that pertain |
|
|
to the file name or the way the buffer contents were obtained. |
|
|
|
|
|
The variable is marked as a permanent local, so that changing the major |
|
|
mode does not alter a buffer-local value. This is convenient for |
|
|
packages that read ``file'' contents in special ways, and set up hooks |
|
|
to save the data in a corresponding way. |
|
|
@end defvar |
|
|
|
|
|
@c Emacs 19 feature |
|
|
@defvar write-contents-hooks |
|
|
This works just like @code{write-file-hooks}, but it is intended for |
|
405 |
hooks that pertain to the contents of the file, as opposed to hooks that |
hooks that pertain to the contents of the file, as opposed to hooks that |
406 |
pertain to where the file came from. Such hooks are usually set up by |
pertain to where the file came from. Such hooks are usually set up by |
407 |
major modes, as buffer-local bindings for this variable. |
major modes, as buffer-local bindings for this variable. |
408 |
|
|
409 |
This variable automatically becomes buffer-local whenever it is set; |
This variable automatically becomes buffer-local whenever it is set; |
410 |
switching to a new major mode always resets this variable. When you use |
switching to a new major mode always resets this variable. |
|
@code{add-hooks} to add an element to this hook, you should @emph{not} |
|
|
specify a non-@code{nil} @var{local} argument, since this variable is |
|
|
used @emph{only} buffer-locally. |
|
411 |
@end defvar |
@end defvar |
412 |
|
|
413 |
@c Emacs 19 feature |
@c Emacs 19 feature |
504 |
This function works like @code{insert-file-contents} except that it does |
This function works like @code{insert-file-contents} except that it does |
505 |
not do format decoding (@pxref{Format Conversion}), does not do |
not do format decoding (@pxref{Format Conversion}), does not do |
506 |
character code conversion (@pxref{Coding Systems}), does not run |
character code conversion (@pxref{Coding Systems}), does not run |
507 |
@code{find-file-hooks}, does not perform automatic uncompression, and so |
@code{find-file-hook}, does not perform automatic uncompression, and so |
508 |
on. |
on. |
509 |
@end defun |
@end defun |
510 |
|
|
548 |
|
|
549 |
If @var{mustbenew} is non-@code{nil}, then @code{write-region} asks |
If @var{mustbenew} is non-@code{nil}, then @code{write-region} asks |
550 |
for confirmation if @var{filename} names an existing file. |
for confirmation if @var{filename} names an existing file. |
551 |
Starting in Emacs 21, if @var{mustbenew} is the symbol @code{excl}, |
Starting in Emacs 21, if @var{mustbenew} is the symbol @code{excl}, |
552 |
then @code{write-region} does not ask for confirmation, but instead |
then @code{write-region} does not ask for confirmation, but instead |
553 |
it signals an error @code{file-already-exists} if the file already |
it signals an error @code{file-already-exists} if the file already |
554 |
exists. |
exists. |
865 |
may be a nonexistent file name. |
may be a nonexistent file name. |
866 |
|
|
867 |
If the file @var{filename} is not a symbolic link (or there is no such file), |
If the file @var{filename} is not a symbolic link (or there is no such file), |
868 |
@code{file-symlink-p} returns @code{nil}. |
@code{file-symlink-p} returns @code{nil}. |
869 |
|
|
870 |
@example |
@example |
871 |
@group |
@group |
1107 |
@example |
@example |
1108 |
@group |
@group |
1109 |
(file-attributes "files.texi") |
(file-attributes "files.texi") |
1110 |
@result{} (nil 1 2235 75 |
@result{} (nil 1 2235 75 |
1111 |
(8489 20284) |
(8489 20284) |
1112 |
(8489 20284) |
(8489 20284) |
1113 |
(8489 20285) |
(8489 20285) |
1114 |
14906 "-rw-rw-rw-" |
14906 "-rw-rw-rw-" |
1115 |
nil 129500 -32252) |
nil 129500 -32252) |
1116 |
@end group |
@end group |
1117 |
@end example |
@end example |
1322 |
|
|
1323 |
@c Emacs 19 feature |
@c Emacs 19 feature |
1324 |
@defun set-default-file-modes mode |
@defun set-default-file-modes mode |
1325 |
|
@cindex umask |
1326 |
This function sets the default file protection for new files created by |
This function sets the default file protection for new files created by |
1327 |
Emacs and its subprocesses. Every file created with Emacs initially has |
Emacs and its subprocesses. Every file created with Emacs initially has |
1328 |
this protection, or a subset of it (@code{write-region} will not give a |
this protection, or a subset of it (@code{write-region} will not give a |
1385 |
|
|
1386 |
@menu |
@menu |
1387 |
* File Name Components:: The directory part of a file name, and the rest. |
* File Name Components:: The directory part of a file name, and the rest. |
1388 |
|
* Relative File Names:: Some file names are relative to a current directory. |
1389 |
* Directory Names:: A directory's name as a directory |
* Directory Names:: A directory's name as a directory |
1390 |
is different from its name as a file. |
is different from its name as a file. |
|
* Relative File Names:: Some file names are relative to a current directory. |
|
1391 |
* File Name Expansion:: Converting relative file names to absolute ones. |
* File Name Expansion:: Converting relative file names to absolute ones. |
1392 |
* Unique File Names:: Generating names for temporary files. |
* Unique File Names:: Generating names for temporary files. |
1393 |
* File Name Completion:: Finding the completions for a given file name. |
* File Name Completion:: Finding the completions for a given file name. |
1421 |
found mostly in directory lists. |
found mostly in directory lists. |
1422 |
|
|
1423 |
@defun file-name-directory filename |
@defun file-name-directory filename |
1424 |
This function returns the directory part of @var{filename} (or |
This function returns the directory part of @var{filename}, as a |
1425 |
@code{nil} if @var{filename} does not include a directory part). On |
directory name (@pxref{Directory Names}), or @code{nil} if |
1426 |
most systems, the function returns a string ending in a slash. On VMS, |
@var{filename} does not include a directory part. |
1427 |
it returns a string ending in one of the three characters @samp{:}, |
|
1428 |
|
On GNU and Unix systems, a string returned by this function always |
1429 |
|
ends in a slash. On MSDOS it can also end in a colon. On VMS, it |
1430 |
|
returns a string ending in one of the three characters @samp{:}, |
1431 |
@samp{]}, or @samp{>}. |
@samp{]}, or @samp{>}. |
1432 |
|
|
1433 |
@example |
@example |
1459 |
@result{} "foo" |
@result{} "foo" |
1460 |
@end group |
@end group |
1461 |
@group |
@group |
1462 |
|
(file-name-nondirectory "lewis/") |
1463 |
|
@result{} "" |
1464 |
|
@end group |
1465 |
|
@group |
1466 |
;; @r{The following example is accurate only on VMS.} |
;; @r{The following example is accurate only on VMS.} |
1467 |
(file-name-nondirectory "[X]FOO.TMP") |
(file-name-nondirectory "[X]FOO.TMP") |
1468 |
@result{} "FOO.TMP" |
@result{} "FOO.TMP" |
1470 |
@end example |
@end example |
1471 |
@end defun |
@end defun |
1472 |
|
|
1473 |
|
@defun file-name-extension filename &optional period |
1474 |
|
This function returns @var{filename}'s final ``extension,'' if any, |
1475 |
|
after applying @code{file-name-sans-versions} to remove any |
1476 |
|
version/backup part. It returns @code{nil} for extensionless file |
1477 |
|
names such as @file{foo}. If @var{period} is non-nil, then the |
1478 |
|
returned value includes the period that delimits the extension, and if |
1479 |
|
@var{filename} has no extension, the value is @code{""}. If the last |
1480 |
|
component of a file name begins with a @samp{.}, that @samp{.} doesn't |
1481 |
|
count as the beginning of an extension, so, for example, |
1482 |
|
@file{.emacs}'s ``extension'' is @code{nil}, not @samp{.emacs}. |
1483 |
|
@end defun |
1484 |
|
|
1485 |
@defun file-name-sans-versions filename &optional keep-backup-version |
@defun file-name-sans-versions filename &optional keep-backup-version |
1486 |
This function returns @var{filename} with any file version numbers, |
This function returns @var{filename} with any file version numbers, |
1487 |
backup version numbers, or trailing tildes discarded. |
backup version numbers, or trailing tildes discarded. |
1523 |
(file-name-sans-extension "big.hack/foo") |
(file-name-sans-extension "big.hack/foo") |
1524 |
@result{} "big.hack/foo" |
@result{} "big.hack/foo" |
1525 |
(file-name-sans-extension "/my/home/.emacs") |
(file-name-sans-extension "/my/home/.emacs") |
1526 |
@result{} "/my/home.emacs" |
@result{} "/my/home/.emacs" |
1527 |
(file-name-sans-extension "/my/home/.emacs.el") |
(file-name-sans-extension "/my/home/.emacs.el") |
1528 |
@result{} "/my/home/.emacs" |
@result{} "/my/home/.emacs" |
1529 |
@end example |
@end example |
1530 |
@end defun |
@end defun |
1531 |
|
|
1532 |
@ignore |
@ignore |
1533 |
Andrew Innes says that this |
Andrew Innes says that this |
1534 |
|
|
1535 |
@c @defvar directory-sep-char |
@c @defvar directory-sep-char |
1536 |
@c @tindex directory-sep-char |
@c @tindex directory-sep-char |
1545 |
@end defvar |
@end defvar |
1546 |
@end ignore |
@end ignore |
1547 |
|
|
1548 |
@defun file-name-extension filename &optional period |
@node Relative File Names |
1549 |
This function returns @var{filename}'s final ``extension,'' if any, |
@subsection Absolute and Relative File Names |
1550 |
after applying @code{file-name-sans-versions} to remove any |
@cindex absolute file name |
1551 |
version/backup part. It returns @code{nil} for extensionless file |
@cindex relative file name |
1552 |
names such as @file{foo}. If @var{period} is non-nil, then the |
|
1553 |
returned value includes the period that delimits the extension, and if |
All the directories in the file system form a tree starting at the |
1554 |
@var{filename} has no extension, the value is @code{""}. If the last |
root directory. A file name can specify all the directory names |
1555 |
component of a file name begins with a @samp{.}, that @samp{.} doesn't |
starting from the root of the tree; then it is called an @dfn{absolute} |
1556 |
count as the beginning of an extension, so, for example, |
file name. Or it can specify the position of the file in the tree |
1557 |
@file{.emacs}'s ``extension'' is @code{nil}, not @samp{.emacs}. |
relative to a default directory; then it is called a @dfn{relative} file |
1558 |
|
name. On Unix and GNU/Linux, an absolute file name starts with a slash |
1559 |
|
or a tilde (@samp{~}), and a relative one does not. On MS-DOS and |
1560 |
|
MS-Windows, an absolute file name starts with a slash or a backslash, or |
1561 |
|
with a drive specification @samp{@var{x}:/}, where @var{x} is the |
1562 |
|
@dfn{drive letter}. The rules on VMS are complicated. |
1563 |
|
|
1564 |
|
@defun file-name-absolute-p filename |
1565 |
|
This function returns @code{t} if file @var{filename} is an absolute |
1566 |
|
file name, @code{nil} otherwise. On VMS, this function understands both |
1567 |
|
Unix syntax and VMS syntax. |
1568 |
|
|
1569 |
|
@example |
1570 |
|
@group |
1571 |
|
(file-name-absolute-p "~rms/foo") |
1572 |
|
@result{} t |
1573 |
|
@end group |
1574 |
|
@group |
1575 |
|
(file-name-absolute-p "rms/foo") |
1576 |
|
@result{} nil |
1577 |
|
@end group |
1578 |
|
@group |
1579 |
|
(file-name-absolute-p "/user/rms/foo") |
1580 |
|
@result{} t |
1581 |
|
@end group |
1582 |
|
@end example |
1583 |
@end defun |
@end defun |
1584 |
|
|
1585 |
@node Directory Names |
@node Directory Names |
1588 |
@cindex directory name |
@cindex directory name |
1589 |
@cindex file name of directory |
@cindex file name of directory |
1590 |
|
|
1591 |
A @dfn{directory name} is the name of a directory. A directory is a |
A @dfn{directory name} is the name of a directory. A directory is |
1592 |
kind of file, and it has a file name, which is related to the directory |
actually a kind of file, so it has a file name, which is related to |
1593 |
name but not identical to it. (This is not quite the same as the usual |
the directory name but not identical to it. (This is not quite the |
1594 |
Unix terminology.) These two different names for the same entity are |
same as the usual Unix terminology.) These two different names for |
1595 |
related by a syntactic transformation. On most systems, this is simple: |
the same entity are related by a syntactic transformation. On GNU and |
1596 |
a directory name ends in a slash (or backslash), whereas the directory's |
Unix systems, this is simple: a directory name ends in a slash (or |
1597 |
name as a file lacks that slash. On VMS, the relationship is more |
backslash), whereas the directory's name as a file lacks that slash. |
1598 |
complicated. |
On MSDOS and VMS, the relationship is more complicated. |
1599 |
|
|
1600 |
The difference between a directory name and its name as a file is |
The difference between a directory name and its name as a file is |
1601 |
subtle but crucial. When an Emacs variable or function argument is |
subtle but crucial. When an Emacs variable or function argument is |
1602 |
described as being a directory name, a file name of a directory is not |
described as being a directory name, a file name of a directory is not |
1603 |
acceptable. |
acceptable. When @code{file-name-directory} returns a string, that is |
1604 |
|
always a directory name. |
1605 |
|
|
1606 |
The following two functions convert between directory names and file |
The following two functions convert between directory names and file |
1607 |
names. They do nothing special with environment variable substitutions |
names. They do nothing special with environment variable substitutions |
1637 |
@end example |
@end example |
1638 |
@end defun |
@end defun |
1639 |
|
|
1640 |
|
Given a directory name, you can combine it with a relative file name |
1641 |
|
using @code{concat}: |
1642 |
|
|
1643 |
|
@example |
1644 |
|
(concat @var{dirname} @var{relfile}) |
1645 |
|
@end example |
1646 |
|
|
1647 |
|
@noindent |
1648 |
|
Be sure to verify that the file name is relative before doing that. |
1649 |
|
If you use an absolute file name, the results could be syntactically |
1650 |
|
invalid or refer to the wrong file. |
1651 |
|
|
1652 |
|
If you want to use a directory file name in making such a |
1653 |
|
combination, you must first convert it to a directory name using |
1654 |
|
@code{file-name-as-directory}: |
1655 |
|
|
1656 |
|
@example |
1657 |
|
(concat (file-name-as-directory @var{dirfile}) @var{relfile}) |
1658 |
|
@end example |
1659 |
|
|
1660 |
|
@noindent |
1661 |
|
Don't try concatenating a slash by hand, as in |
1662 |
|
|
1663 |
|
@example |
1664 |
|
;;; @r{Wrong!} |
1665 |
|
(concat @var{dirfile} "/" @var{relfile}) |
1666 |
|
@end example |
1667 |
|
|
1668 |
|
@noindent |
1669 |
|
because this is not portable. Always use |
1670 |
|
@code{file-name-as-directory}. |
1671 |
|
|
1672 |
@cindex directory name abbreviation |
@cindex directory name abbreviation |
1673 |
Directory name abbreviations are useful for directories that are |
Directory name abbreviations are useful for directories that are |
1674 |
normally accessed through symbolic links. Sometimes the users recognize |
normally accessed through symbolic links. Sometimes the users recognize |
1702 |
To convert a directory name to its abbreviation, use this |
To convert a directory name to its abbreviation, use this |
1703 |
function: |
function: |
1704 |
|
|
1705 |
@defun abbreviate-file-name dirname |
@defun abbreviate-file-name filename |
1706 |
This function applies abbreviations from @code{directory-abbrev-alist} |
This function applies abbreviations from @code{directory-abbrev-alist} |
1707 |
to its argument, and substitutes @samp{~} for the user's home |
to its argument, and substitutes @samp{~} for the user's home |
1708 |
directory. |
directory. You can use it for directory names and for file names, |
1709 |
@end defun |
because it recognizes abbreviations even as part of the name. |
|
|
|
|
@node Relative File Names |
|
|
@subsection Absolute and Relative File Names |
|
|
@cindex absolute file name |
|
|
@cindex relative file name |
|
|
|
|
|
All the directories in the file system form a tree starting at the |
|
|
root directory. A file name can specify all the directory names |
|
|
starting from the root of the tree; then it is called an @dfn{absolute} |
|
|
file name. Or it can specify the position of the file in the tree |
|
|
relative to a default directory; then it is called a @dfn{relative} file |
|
|
name. On Unix and GNU/Linux, an absolute file name starts with a slash |
|
|
or a tilde (@samp{~}), and a relative one does not. On MS-DOS and |
|
|
MS-Windows, an absolute file name starts with a slash or a backslash, or |
|
|
with a drive specification @samp{@var{x}:/}, where @var{x} is the |
|
|
@dfn{drive letter}. The rules on VMS are complicated. |
|
|
|
|
|
@defun file-name-absolute-p filename |
|
|
This function returns @code{t} if file @var{filename} is an absolute |
|
|
file name, @code{nil} otherwise. On VMS, this function understands both |
|
|
Unix syntax and VMS syntax. |
|
|
|
|
|
@example |
|
|
@group |
|
|
(file-name-absolute-p "~rms/foo") |
|
|
@result{} t |
|
|
@end group |
|
|
@group |
|
|
(file-name-absolute-p "rms/foo") |
|
|
@result{} nil |
|
|
@end group |
|
|
@group |
|
|
(file-name-absolute-p "/user/rms/foo") |
|
|
@result{} t |
|
|
@end group |
|
|
@end example |
|
1710 |
@end defun |
@end defun |
1711 |
|
|
1712 |
@node File Name Expansion |
@node File Name Expansion |
1974 |
@example |
@example |
1975 |
@group |
@group |
1976 |
(file-name-all-completions "f" "") |
(file-name-all-completions "f" "") |
1977 |
@result{} ("foo" "file~" "file.c.~2~" |
@result{} ("foo" "file~" "file.c.~2~" |
1978 |
"file.c.~1~" "file.c") |
"file.c.~1~" "file.c") |
1979 |
@end group |
@end group |
1980 |
|
|
1981 |
@group |
@group |
1982 |
(file-name-all-completions "fo" "") |
(file-name-all-completions "fo" "") |
1983 |
@result{} ("foo") |
@result{} ("foo") |
1984 |
@end group |
@end group |
1985 |
@end example |
@end example |
2126 |
@group |
@group |
2127 |
(directory-files "~lewis") |
(directory-files "~lewis") |
2128 |
@result{} ("#foo#" "#foo.el#" "." ".." |
@result{} ("#foo#" "#foo.el#" "." ".." |
2129 |
"dired-mods.el" "files.texi" |
"dired-mods.el" "files.texi" |
2130 |
"files.texi.~1~") |
"files.texi.~1~") |
2131 |
@end group |
@end group |
2132 |
@end example |
@end example |
2280 |
|
|
2281 |
@ifnottex |
@ifnottex |
2282 |
@noindent |
@noindent |
2283 |
@code{add-name-to-file}, @code{copy-file}, @code{delete-directory}, |
@code{access-file}, @code{add-name-to-file}, |
2284 |
|
@code{byte-compiler-base-file-name},@* |
2285 |
|
@code{copy-file}, @code{delete-directory}, |
2286 |
@code{delete-file}, |
@code{delete-file}, |
2287 |
@code{diff-latest-backup-file}, |
@code{diff-latest-backup-file}, |
2288 |
@code{directory-file-name}, |
@code{directory-file-name}, |
2289 |
@code{directory-files}, |
@code{directory-files}, |
2290 |
|
@code{directory-files-and-attributes}, |
2291 |
@code{dired-call-process}, |
@code{dired-call-process}, |
2292 |
@code{dired-compress-file}, @code{dired-uncache}, |
@code{dired-compress-file}, @code{dired-uncache},@* |
2293 |
@code{expand-file-name}, |
@code{expand-file-name}, |
2294 |
@code{file-accessible-directory-p},@* |
@code{file-accessible-directory-p}, |
2295 |
@code{file-attributes}, |
@code{file-attributes}, |
2296 |
@code{file-directory-p}, |
@code{file-directory-p}, |
2297 |
@code{file-executable-p}, @code{file-exists-p},@* |
@code{file-executable-p}, @code{file-exists-p}, |
2298 |
@code{file-local-copy}, |
@code{file-local-copy}, |
2299 |
@code{file-modes}, @code{file-name-all-completions},@* |
@code{file-modes}, @code{file-name-all-completions}, |
2300 |
@code{file-name-as-directory}, |
@code{file-name-as-directory}, |
2301 |
@code{file-name-completion}, |
@code{file-name-completion}, |
2302 |
@code{file-name-directory}, |
@code{file-name-directory}, |
2306 |
@code{file-readable-p}, @code{file-regular-p}, @code{file-symlink-p}, |
@code{file-readable-p}, @code{file-regular-p}, @code{file-symlink-p}, |
2307 |
@code{file-truename}, @code{file-writable-p}, |
@code{file-truename}, @code{file-writable-p}, |
2308 |
@code{find-backup-file-name}, |
@code{find-backup-file-name}, |
2309 |
@code{get-file-buffer},@* |
@code{find-file-noselect},@* |
2310 |
|
@code{get-file-buffer}, |
2311 |
@code{insert-directory}, |
@code{insert-directory}, |
2312 |
@code{insert-file-contents}, |
@code{insert-file-contents},@* |
2313 |
@code{load}, @code{make-directory}, |
@code{load}, @code{make-directory}, |
2314 |
@code{make-symbolic-link}, @code{rename-file}, @code{set-file-modes}, |
@code{make-directory-internal}, |
2315 |
@code{set-visited-file-modtime}, @code{shell-command},@* |
@code{make-symbolic-link},@* |
2316 |
|
@code{rename-file}, @code{set-file-modes}, |
2317 |
|
@code{set-visited-file-modtime}, @code{shell-command}, |
2318 |
|
@code{substitute-in-file-name},@* |
2319 |
@code{unhandled-file-name-directory}, |
@code{unhandled-file-name-directory}, |
2320 |
@code{vc-registered}, |
@code{vc-registered}, |
2321 |
@code{verify-visited-file-modtime},@* |
@code{verify-visited-file-modtime},@* |
2324 |
@iftex |
@iftex |
2325 |
@noindent |
@noindent |
2326 |
@flushleft |
@flushleft |
2327 |
@code{add-name-to-file}, @code{copy-file}, @code{delete-directory}, |
@code{access-file}, @code{add-name-to-file}, |
2328 |
|
@code{byte-com@discretionary{}{}{}piler-base-file-name}, |
2329 |
|
@code{copy-file}, @code{delete-directory}, |
2330 |
@code{delete-file}, |
@code{delete-file}, |
2331 |
@code{diff-latest-backup-file}, |
@code{diff-latest-backup-file}, |
2332 |
@code{directory-file-name}, |
@code{directory-file-name}, |
2333 |
@code{directory-files}, |
@code{directory-files}, |
2334 |
|
@code{directory-files-and-at@discretionary{}{}{}tributes}, |
2335 |
@code{dired-call-process}, |
@code{dired-call-process}, |
2336 |
@code{dired-compress-file}, @code{dired-uncache}, |
@code{dired-compress-file}, @code{dired-uncache}, |
2337 |
@code{expand-file-name}, |
@code{expand-file-name}, |
2350 |
@code{file-readable-p}, @code{file-regular-p}, @code{file-symlink-p}, |
@code{file-readable-p}, @code{file-regular-p}, @code{file-symlink-p}, |
2351 |
@code{file-truename}, @code{file-writable-p}, |
@code{file-truename}, @code{file-writable-p}, |
2352 |
@code{find-backup-file-name}, |
@code{find-backup-file-name}, |
2353 |
|
@code{find-file-noselect}, |
2354 |
@code{get-file-buffer}, |
@code{get-file-buffer}, |
2355 |
@code{insert-directory}, |
@code{insert-directory}, |
2356 |
@code{insert-file-contents}, |
@code{insert-file-contents}, |
2357 |
@code{load}, @code{make-direc@discretionary{}{}{}tory}, |
@code{load}, @code{make-direc@discretionary{}{}{}tory}, |
2358 |
@code{make-symbolic-link}, @code{rename-file}, @code{set-file-modes}, |
@code{make-direc@discretionary{}{}{}tory-internal}, |
2359 |
|
@code{make-symbolic-link}, |
2360 |
|
@code{rename-file}, @code{set-file-modes}, |
2361 |
@code{set-visited-file-modtime}, @code{shell-command}, |
@code{set-visited-file-modtime}, @code{shell-command}, |
2362 |
|
@code{substitute-in-file-name}, |
2363 |
@code{unhandled-file-name-directory}, |
@code{unhandled-file-name-directory}, |
2364 |
@code{vc-regis@discretionary{}{}{}tered}, |
@code{vc-regis@discretionary{}{}{}tered}, |
2365 |
@code{verify-visited-file-modtime}, |
@code{verify-visited-file-modtime}, |
2388 |
@dots{} |
@dots{} |
2389 |
;; @r{Handle any operation we don't know about.} |
;; @r{Handle any operation we don't know about.} |
2390 |
(t (let ((inhibit-file-name-handlers |
(t (let ((inhibit-file-name-handlers |
2391 |
(cons 'my-file-handler |
(cons 'my-file-handler |
2392 |
(and (eq inhibit-file-name-operation operation) |
(and (eq inhibit-file-name-operation operation) |
2393 |
inhibit-file-name-handlers))) |
inhibit-file-name-handlers))) |
2394 |
(inhibit-file-name-operation operation)) |
(inhibit-file-name-operation operation)) |