Mercurial > emacs
comparison lispref/files.texi @ 49600:23a1cea22d13
Trailing whitespace deleted.
author | Juanma Barranquero <lekktu@gmail.com> |
---|---|
date | Tue, 04 Feb 2003 14:56:31 +0000 |
parents | 5492d1831d2a |
children | 3bf63c244c44 d7ddb3e565de |
comparison
equal
deleted
inserted
replaced
49599:5ade352e8d1c | 49600:23a1cea22d13 |
---|---|
1 @c -*-texinfo-*- | 1 @c -*-texinfo-*- |
2 @c This is part of the GNU Emacs Lisp Reference Manual. | 2 @c This is part of the GNU Emacs Lisp Reference Manual. |
3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 | 3 @c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999 |
4 @c Free Software Foundation, Inc. | 4 @c Free Software Foundation, Inc. |
5 @c See the file elisp.texi for copying conditions. | 5 @c See the file elisp.texi for copying conditions. |
6 @setfilename ../info/files | 6 @setfilename ../info/files |
7 @node Files, Backups and Auto-Saving, Documentation, Top | 7 @node Files, Backups and Auto-Saving, Documentation, Top |
8 @comment node-name, next, previous, up | 8 @comment node-name, next, previous, up |
9 @chapter Files | 9 @chapter Files |
90 temporary buffer. Visiting the file is not necessary and takes longer. | 90 temporary buffer. Visiting the file is not necessary and takes longer. |
91 @xref{Reading from Files}. | 91 @xref{Reading from Files}. |
92 | 92 |
93 @deffn Command find-file filename &optional wildcards | 93 @deffn Command find-file filename &optional wildcards |
94 This command selects a buffer visiting the file @var{filename}, | 94 This command selects a buffer visiting the file @var{filename}, |
95 using an existing buffer if there is one, and otherwise creating a | 95 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. | 96 new buffer and reading the file into it. It also returns that buffer. |
97 | 97 |
98 The body of the @code{find-file} function is very simple and looks | 98 The body of the @code{find-file} function is very simple and looks |
99 like this: | 99 like this: |
100 | 100 |
546 @var{append} is an integer, then @code{write-region} seeks to that byte | 546 @var{append} is an integer, then @code{write-region} seeks to that byte |
547 offset from the start of the file and writes the data from there. | 547 offset from the start of the file and writes the data from there. |
548 | 548 |
549 If @var{mustbenew} is non-@code{nil}, then @code{write-region} asks | 549 If @var{mustbenew} is non-@code{nil}, then @code{write-region} asks |
550 for confirmation if @var{filename} names an existing file. | 550 for confirmation if @var{filename} names an existing file. |
551 Starting in Emacs 21, if @var{mustbenew} is the symbol @code{excl}, | 551 Starting in Emacs 21, if @var{mustbenew} is the symbol @code{excl}, |
552 then @code{write-region} does not ask for confirmation, but instead | 552 then @code{write-region} does not ask for confirmation, but instead |
553 it signals an error @code{file-already-exists} if the file already | 553 it signals an error @code{file-already-exists} if the file already |
554 exists. | 554 exists. |
555 | 555 |
556 The test for an existing file, when @var{mustbenew} is @code{excl}, uses | 556 The test for an existing file, when @var{mustbenew} is @code{excl}, uses |
863 function returns the file name to which it is linked. This may be the | 863 function returns the file name to which it is linked. This may be the |
864 name of a text file, a directory, or even another symbolic link, or it | 864 name of a text file, a directory, or even another symbolic link, or it |
865 may be a nonexistent file name. | 865 may be a nonexistent file name. |
866 | 866 |
867 If the file @var{filename} is not a symbolic link (or there is no such file), | 867 If the file @var{filename} is not a symbolic link (or there is no such file), |
868 @code{file-symlink-p} returns @code{nil}. | 868 @code{file-symlink-p} returns @code{nil}. |
869 | 869 |
870 @example | 870 @example |
871 @group | 871 @group |
872 (file-symlink-p "foo") | 872 (file-symlink-p "foo") |
873 @result{} nil | 873 @result{} nil |
1105 For example, here are the file attributes for @file{files.texi}: | 1105 For example, here are the file attributes for @file{files.texi}: |
1106 | 1106 |
1107 @example | 1107 @example |
1108 @group | 1108 @group |
1109 (file-attributes "files.texi") | 1109 (file-attributes "files.texi") |
1110 @result{} (nil 1 2235 75 | 1110 @result{} (nil 1 2235 75 |
1111 (8489 20284) | 1111 (8489 20284) |
1112 (8489 20284) | 1112 (8489 20284) |
1113 (8489 20285) | 1113 (8489 20285) |
1114 14906 "-rw-rw-rw-" | 1114 14906 "-rw-rw-rw-" |
1115 nil 129500 -32252) | 1115 nil 129500 -32252) |
1116 @end group | 1116 @end group |
1117 @end example | 1117 @end example |
1118 | 1118 |
1119 @noindent | 1119 @noindent |
1528 @result{} "/my/home/.emacs" | 1528 @result{} "/my/home/.emacs" |
1529 @end example | 1529 @end example |
1530 @end defun | 1530 @end defun |
1531 | 1531 |
1532 @ignore | 1532 @ignore |
1533 Andrew Innes says that this | 1533 Andrew Innes says that this |
1534 | 1534 |
1535 @c @defvar directory-sep-char | 1535 @c @defvar directory-sep-char |
1536 @c @tindex directory-sep-char | 1536 @c @tindex directory-sep-char |
1537 This variable holds the character that Emacs normally uses to separate | 1537 This variable holds the character that Emacs normally uses to separate |
1538 file name components. The default value is @code{?/}, but on MS-Windows | 1538 file name components. The default value is @code{?/}, but on MS-Windows |
1972 @file{file.c.~2~}.@refill | 1972 @file{file.c.~2~}.@refill |
1973 | 1973 |
1974 @example | 1974 @example |
1975 @group | 1975 @group |
1976 (file-name-all-completions "f" "") | 1976 (file-name-all-completions "f" "") |
1977 @result{} ("foo" "file~" "file.c.~2~" | 1977 @result{} ("foo" "file~" "file.c.~2~" |
1978 "file.c.~1~" "file.c") | 1978 "file.c.~1~" "file.c") |
1979 @end group | 1979 @end group |
1980 | 1980 |
1981 @group | 1981 @group |
1982 (file-name-all-completions "fo" "") | 1982 (file-name-all-completions "fo" "") |
1983 @result{} ("foo") | 1983 @result{} ("foo") |
1984 @end group | 1984 @end group |
1985 @end example | 1985 @end example |
1986 @end defun | 1986 @end defun |
1987 | 1987 |
2124 | 2124 |
2125 @example | 2125 @example |
2126 @group | 2126 @group |
2127 (directory-files "~lewis") | 2127 (directory-files "~lewis") |
2128 @result{} ("#foo#" "#foo.el#" "." ".." | 2128 @result{} ("#foo#" "#foo.el#" "." ".." |
2129 "dired-mods.el" "files.texi" | 2129 "dired-mods.el" "files.texi" |
2130 "files.texi.~1~") | 2130 "files.texi.~1~") |
2131 @end group | 2131 @end group |
2132 @end example | 2132 @end example |
2133 | 2133 |
2134 An error is signaled if @var{directory} is not the name of a directory | 2134 An error is signaled if @var{directory} is not the name of a directory |
2386 (cond ((eq operation 'insert-file-contents) @dots{}) | 2386 (cond ((eq operation 'insert-file-contents) @dots{}) |
2387 ((eq operation 'write-region) @dots{}) | 2387 ((eq operation 'write-region) @dots{}) |
2388 @dots{} | 2388 @dots{} |
2389 ;; @r{Handle any operation we don't know about.} | 2389 ;; @r{Handle any operation we don't know about.} |
2390 (t (let ((inhibit-file-name-handlers | 2390 (t (let ((inhibit-file-name-handlers |
2391 (cons 'my-file-handler | 2391 (cons 'my-file-handler |
2392 (and (eq inhibit-file-name-operation operation) | 2392 (and (eq inhibit-file-name-operation operation) |
2393 inhibit-file-name-handlers))) | 2393 inhibit-file-name-handlers))) |
2394 (inhibit-file-name-operation operation)) | 2394 (inhibit-file-name-operation operation)) |
2395 (apply operation args))))) | 2395 (apply operation args))))) |
2396 @end smallexample | 2396 @end smallexample |