comparison lispref/files.texi @ 90796:4ef881a120fe

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 675-697) - Update from CVS - Merge from gnus--rel--5.10 - Release ERC 5.2. * gnus--rel--5.10 (patch 211-215) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-189
author Miles Bader <miles@gnu.org>
date Wed, 11 Apr 2007 00:17:47 +0000
parents f83d17e1ace6 1f4b88ab053d
children e6fdae9180d4
comparison
equal deleted inserted replaced
90795:b9182b6a90c9 90796:4ef881a120fe
294 in the list @code{find-file-hook}. 294 in the list @code{find-file-hook}.
295 @end defun 295 @end defun
296 296
297 @node Saving Buffers 297 @node Saving Buffers
298 @section Saving Buffers 298 @section Saving Buffers
299 @cindex saving buffers
299 300
300 When you edit a file in Emacs, you are actually working on a buffer 301 When you edit a file in Emacs, you are actually working on a buffer
301 that is visiting that file---that is, the contents of the file are 302 that is visiting that file---that is, the contents of the file are
302 copied into the buffer and the copy is what you edit. Changes to the 303 copied into the buffer and the copy is what you edit. Changes to the
303 buffer do not change the file until you @dfn{save} the buffer, which 304 buffer do not change the file until you @dfn{save} the buffer, which
479 Name}). 480 Name}).
480 481
481 @node Reading from Files 482 @node Reading from Files
482 @comment node-name, next, previous, up 483 @comment node-name, next, previous, up
483 @section Reading from Files 484 @section Reading from Files
485 @cindex reading from files
484 486
485 You can copy a file from the disk and insert it into a buffer 487 You can copy a file from the disk and insert it into a buffer
486 using the @code{insert-file-contents} function. Don't use the user-level 488 using the @code{insert-file-contents} function. Don't use the user-level
487 command @code{insert-file} in a Lisp program, as that sets the mark. 489 command @code{insert-file} in a Lisp program, as that sets the mark.
488 490
542 @ref{Magic File Names}. 544 @ref{Magic File Names}.
543 545
544 @node Writing to Files 546 @node Writing to Files
545 @comment node-name, next, previous, up 547 @comment node-name, next, previous, up
546 @section Writing to Files 548 @section Writing to Files
549 @cindex writing to files
547 550
548 You can write the contents of a buffer, or part of a buffer, directly 551 You can write the contents of a buffer, or part of a buffer, directly
549 to a file on disk using the @code{append-to-file} and 552 to a file on disk using the @code{append-to-file} and
550 @code{write-region} functions. Don't use these functions to write to 553 @code{write-region} functions. Don't use these functions to write to
551 files that are being visited; that could cause confusion in the 554 files that are being visited; that could cause confusion in the
645 @end defmac 648 @end defmac
646 649
647 @node File Locks 650 @node File Locks
648 @section File Locks 651 @section File Locks
649 @cindex file locks 652 @cindex file locks
653 @cindex lock file
650 654
651 When two users edit the same file at the same time, they are likely 655 When two users edit the same file at the same time, they are likely
652 to interfere with each other. Emacs tries to prevent this situation 656 to interfere with each other. Emacs tries to prevent this situation
653 from arising by recording a @dfn{file lock} when a file is being 657 from arising by recording a @dfn{file lock} when a file is being
654 modified. (File locks are not implemented on Microsoft systems.) 658 modified. (File locks are not implemented on Microsoft systems.)
734 for its usual definition is in @file{userlock.el}. 738 for its usual definition is in @file{userlock.el}.
735 @end defun 739 @end defun
736 740
737 @node Information about Files 741 @node Information about Files
738 @section Information about Files 742 @section Information about Files
743 @cindex file, information about
739 744
740 The functions described in this section all operate on strings that 745 The functions described in this section all operate on strings that
741 designate file names. With a few exceptions, all the functions have 746 designate file names. With a few exceptions, all the functions have
742 names that begin with the word @samp{file}. These functions all 747 names that begin with the word @samp{file}. These functions all
743 return information about actual files or directories, so their 748 return information about actual files or directories, so their
1170 the second has the low 16 bits. (This is similar to the 1175 the second has the low 16 bits. (This is similar to the
1171 value of @code{current-time}; see @ref{Time of Day}.) 1176 value of @code{current-time}; see @ref{Time of Day}.)
1172 1177
1173 @item 1178 @item
1174 The time of last modification as a list of two integers (as above). 1179 The time of last modification as a list of two integers (as above).
1180 @cindex modification time of file
1175 1181
1176 @item 1182 @item
1177 The time of last status change as a list of two integers (as above). 1183 The time of last status change as a list of two integers (as above).
1178 1184
1179 @item 1185 @item
1260 @end table 1266 @end table
1261 @end defun 1267 @end defun
1262 1268
1263 @node Locating Files 1269 @node Locating Files
1264 @subsection How to Locate Files in Standard Places 1270 @subsection How to Locate Files in Standard Places
1265 @cindex locate files 1271 @cindex locate file in path
1266 @cindex find files 1272 @cindex find file in path
1267 1273
1268 This section explains how to search for a file in a list of 1274 This section explains how to search for a file in a list of
1269 directories. One example is when you need to look for a program's 1275 directories (a @dfn{path}). One example is when you need to look for
1270 executable file, e.g., to find out whether a given program is 1276 a program's executable file, e.g., to find out whether a given program
1271 installed on the user's system. Another example is the search for 1277 is installed on the user's system. Another example is the search for
1272 Lisp libraries (@pxref{Library Search}). Such searches generally need 1278 Lisp libraries (@pxref{Library Search}). Such searches generally need
1273 to try various possible file name extensions, in addition to various 1279 to try various possible file name extensions, in addition to various
1274 possible directories. Emacs provides a function for such a 1280 possible directories. Emacs provides a function for such a
1275 generalized search for a file. 1281 generalized search for a file.
1276 1282
1309 For compatibility, @var{predicate} can also be one of the symbols 1315 For compatibility, @var{predicate} can also be one of the symbols
1310 @code{executable}, @code{readable}, @code{writable}, @code{exists}, or 1316 @code{executable}, @code{readable}, @code{writable}, @code{exists}, or
1311 a list of one or more of these symbols. 1317 a list of one or more of these symbols.
1312 @end defun 1318 @end defun
1313 1319
1314 @cindex find executable program
1315 @defun executable-find program 1320 @defun executable-find program
1316 This function searches for the executable file of the named 1321 This function searches for the executable file of the named
1317 @var{program} and returns the full absolute name of the executable, 1322 @var{program} and returns the full absolute name of the executable,
1318 including its file-name extensions, if any. It returns @code{nil} if 1323 including its file-name extensions, if any. It returns @code{nil} if
1319 the file is not found. The functions searches in all the directories 1324 the file is not found. The functions searches in all the directories
1321 @code{exec-suffixes}. 1326 @code{exec-suffixes}.
1322 @end defun 1327 @end defun
1323 1328
1324 @node Changing Files 1329 @node Changing Files
1325 @section Changing File Names and Attributes 1330 @section Changing File Names and Attributes
1326 @cindex renaming files 1331 @c @cindex renaming files Duplicates rename-file
1327 @cindex copying files 1332 @cindex copying files
1328 @cindex deleting files 1333 @cindex deleting files
1329 @cindex linking files 1334 @cindex linking files
1330 @cindex setting modes of files 1335 @cindex setting modes of files
1331 1336
2457 which generate the listing with Lisp code. 2462 which generate the listing with Lisp code.
2458 @end defvar 2463 @end defvar
2459 2464
2460 @node Create/Delete Dirs 2465 @node Create/Delete Dirs
2461 @section Creating and Deleting Directories 2466 @section Creating and Deleting Directories
2467 @cindex creating and deleting directories
2462 @c Emacs 19 features 2468 @c Emacs 19 features
2463 2469
2464 Most Emacs Lisp file-manipulation functions get errors when used on 2470 Most Emacs Lisp file-manipulation functions get errors when used on
2465 files that are directories. For example, you cannot delete a directory 2471 files that are directories. For example, you cannot delete a directory
2466 with @code{delete-file}. These special functions exist to create and 2472 with @code{delete-file}. These special functions exist to create and