comparison man/lispref/files.texi @ 5791:9fae6227ede5

Silence texinfo 5.2 warnings, primarily by adding next, prev, and up pointers to all nodes. See xemacs-patches message with ID <5315f7bf.sHpFD7lXYR05GH6E%james@xemacs.org>.
author Jerry James <james@xemacs.org>
date Thu, 27 Mar 2014 08:59:03 -0600
parents 576fb035e263
children
comparison
equal deleted inserted replaced
5790:dcf9067f26bb 5791:9fae6227ede5
36 * Partial Files:: Treating a section of a buffer as a file. 36 * Partial Files:: Treating a section of a buffer as a file.
37 * Format Conversion:: Conversion to and from various file formats. 37 * Format Conversion:: Conversion to and from various file formats.
38 * Files and MS-DOS:: Distinguishing text and binary files on MS-DOS. 38 * Files and MS-DOS:: Distinguishing text and binary files on MS-DOS.
39 @end menu 39 @end menu
40 40
41 @node Visiting Files 41 @node Visiting Files, Saving Buffers, Files, Files
42 @section Visiting Files 42 @section Visiting Files
43 @cindex finding files 43 @cindex finding files
44 @cindex visiting files 44 @cindex visiting files
45 45
46 Visiting a file means reading a file into a buffer. Once this is 46 Visiting a file means reading a file into a buffer. Once this is
68 @menu 68 @menu
69 * Visiting Functions:: The usual interface functions for visiting. 69 * Visiting Functions:: The usual interface functions for visiting.
70 * Subroutines of Visiting:: Lower-level subroutines that they use. 70 * Subroutines of Visiting:: Lower-level subroutines that they use.
71 @end menu 71 @end menu
72 72
73 @node Visiting Functions 73 @node Visiting Functions, Subroutines of Visiting, Visiting Files, Visiting Files
74 @subsection Functions for Visiting Files 74 @subsection Functions for Visiting Files
75 75
76 This section describes the functions normally used to visit files. 76 This section describes the functions normally used to visit files.
77 For historical reasons, these functions have names starting with 77 For historical reasons, these functions have names starting with
78 @samp{find-} rather than @samp{visit-}. @xref{Buffer File Name}, for 78 @samp{find-} rather than @samp{visit-}. @xref{Buffer File Name}, for
195 195
196 This is not a normal hook because the values of the functions are 196 This is not a normal hook because the values of the functions are
197 used and they may not all be called. 197 used and they may not all be called.
198 @end defvar 198 @end defvar
199 199
200 @node Subroutines of Visiting 200 @node Subroutines of Visiting, , Visiting Functions, Visiting Files
201 @subsection Subroutines of Visiting 201 @subsection Subroutines of Visiting
202 202
203 The @code{find-file-noselect} function uses the 203 The @code{find-file-noselect} function uses the
204 @code{create-file-buffer} and @code{after-find-file} functions as 204 @code{create-file-buffer} and @code{after-find-file} functions as
205 subroutines. Sometimes it is useful to call them directly. 205 subroutines. Sometimes it is useful to call them directly.
255 255
256 The last thing @code{after-find-file} does is call all the functions 256 The last thing @code{after-find-file} does is call all the functions
257 in @code{find-file-hooks}. 257 in @code{find-file-hooks}.
258 @end defun 258 @end defun
259 259
260 @node Saving Buffers 260 @node Saving Buffers, Reading from Files, Visiting Files, Files
261 @section Saving Buffers 261 @section Saving Buffers
262 262
263 When you edit a file in XEmacs, you are actually working on a buffer 263 When you edit a file in XEmacs, you are actually working on a buffer
264 that is visiting that file---that is, the contents of the file are 264 that is visiting that file---that is, the contents of the file are
265 copied into the buffer and the copy is what you edit. Changes to the 265 copied into the buffer and the copy is what you edit. Changes to the
397 If the value of the variable is @code{nil}, then @code{save-buffer} 397 If the value of the variable is @code{nil}, then @code{save-buffer}
398 doesn't add newlines at all. @code{nil} is the default value, but a few 398 doesn't add newlines at all. @code{nil} is the default value, but a few
399 major modes set it to @code{t} in particular buffers. 399 major modes set it to @code{t} in particular buffers.
400 @end defopt 400 @end defopt
401 401
402 @node Reading from Files 402 @node Reading from Files, Writing to Files, Saving Buffers, Files
403 @section Reading from Files 403 @section Reading from Files
404 404
405 You can copy a file from the disk and insert it into a buffer 405 You can copy a file from the disk and insert it into a buffer
406 using the @code{insert-file-contents} function. Don't use the user-level 406 using the @code{insert-file-contents} function. Don't use the user-level
407 command @code{insert-file} in a Lisp program, as that sets the mark. 407 command @code{insert-file} in a Lisp program, as that sets the mark.
444 444
445 If you want to pass a file name to another process so that another 445 If you want to pass a file name to another process so that another
446 program can read the file, use the function @code{file-local-copy}; see 446 program can read the file, use the function @code{file-local-copy}; see
447 @ref{Magic File Names}. 447 @ref{Magic File Names}.
448 448
449 @node Writing to Files 449 @node Writing to Files, File Locks, Reading from Files, Files
450 @section Writing to Files 450 @section Writing to Files
451 451
452 You can write the contents of a buffer, or part of a buffer, directly 452 You can write the contents of a buffer, or part of a buffer, directly
453 to a file on disk using the @code{append-to-file} and 453 to a file on disk using the @code{append-to-file} and
454 @code{write-region} functions. Don't use these functions to write to 454 @code{write-region} functions. Don't use these functions to write to
502 nor @code{nil} nor a string, then this message is inhibited. This 502 nor @code{nil} nor a string, then this message is inhibited. This
503 feature is useful for programs that use files for internal purposes, 503 feature is useful for programs that use files for internal purposes,
504 files that the user does not need to know about. 504 files that the user does not need to know about.
505 @end deffn 505 @end deffn
506 506
507 @node File Locks 507 @node File Locks, Information about Files, Writing to Files, Files
508 @section File Locks 508 @section File Locks
509 @cindex file locks 509 @cindex file locks
510 510
511 When two users edit the same file at the same time, they are likely to 511 When two users edit the same file at the same time, they are likely to
512 interfere with each other. XEmacs tries to prevent this situation from 512 interfere with each other. XEmacs tries to prevent this situation from
585 to do. If you wish, you can replace the @code{ask-user-about-lock} 585 to do. If you wish, you can replace the @code{ask-user-about-lock}
586 function with your own version that decides in another way. The code 586 function with your own version that decides in another way. The code
587 for its usual definition is in @file{userlock.el}. 587 for its usual definition is in @file{userlock.el}.
588 @end defun 588 @end defun
589 589
590 @node Information about Files 590 @node Information about Files, Changing File Attributes, File Locks, Files
591 @section Information about Files 591 @section Information about Files
592 592
593 The functions described in this section all operate on strings that 593 The functions described in this section all operate on strings that
594 designate file names. All the functions have names that begin with the 594 designate file names. All the functions have names that begin with the
595 word @samp{file}. These functions all return information about actual 595 word @samp{file}. These functions all return information about actual
601 * Kinds of Files:: Is it a directory? A symbolic link? 601 * Kinds of Files:: Is it a directory? A symbolic link?
602 * Truenames:: Eliminating symbolic links from a file name. 602 * Truenames:: Eliminating symbolic links from a file name.
603 * File Attributes:: How large is it? Any other names? Etc. 603 * File Attributes:: How large is it? Any other names? Etc.
604 @end menu 604 @end menu
605 605
606 @node Testing Accessibility 606 @node Testing Accessibility, Kinds of Files, Information about Files, Information about Files
607 @subsection Testing Accessibility 607 @subsection Testing Accessibility
608 @cindex accessibility of a file 608 @cindex accessibility of a file
609 @cindex file accessibility 609 @cindex file accessibility
610 610
611 These functions test for permission to access a file in specific ways. 611 These functions test for permission to access a file in specific ways.
736 736
737 You can use @code{file-attributes} to get a file's last modification 737 You can use @code{file-attributes} to get a file's last modification
738 time as a list of two numbers. @xref{File Attributes}. 738 time as a list of two numbers. @xref{File Attributes}.
739 @end defun 739 @end defun
740 740
741 @node Kinds of Files 741 @node Kinds of Files, Truenames, Testing Accessibility, Information about Files
742 @subsection Distinguishing Kinds of Files 742 @subsection Distinguishing Kinds of Files
743 743
744 This section describes how to distinguish various kinds of files, such 744 This section describes how to distinguish various kinds of files, such
745 as directories, symbolic links, and ordinary files. 745 as directories, symbolic links, and ordinary files.
746 746
809 This function returns @code{t} if the file @var{filename} exists and is 809 This function returns @code{t} if the file @var{filename} exists and is
810 a regular file (not a directory, symbolic link, named pipe, terminal, or 810 a regular file (not a directory, symbolic link, named pipe, terminal, or
811 other I/O device). 811 other I/O device).
812 @end defun 812 @end defun
813 813
814 @node Truenames 814 @node Truenames, File Attributes, Kinds of Files, Information about Files
815 @subsection Truenames 815 @subsection Truenames
816 @cindex truename (of file) 816 @cindex truename (of file)
817 817
818 @c Emacs 19 features 818 @c Emacs 19 features
819 The @dfn{truename} of a file is the name that you get by following 819 The @dfn{truename} of a file is the name that you get by following
834 value of @code{default-directory} is used. 834 value of @code{default-directory} is used.
835 @end defun 835 @end defun
836 836
837 @xref{Buffer File Name}, for related information. 837 @xref{Buffer File Name}, for related information.
838 838
839 @node File Attributes 839 @node File Attributes, , Truenames, Information about Files
840 @subsection Other Information about Files 840 @subsection Other Information about Files
841 841
842 This section describes the functions for getting detailed information 842 This section describes the functions for getting detailed information
843 about a file, other than its contents. This information includes the 843 about a file, other than its contents. This information includes the
844 mode bits that control access permission, the owner and group numbers, 844 mode bits that control access permission, the owner and group numbers,
1027 @item -32252 1027 @item -32252
1028 is on file system number -32252. 1028 is on file system number -32252.
1029 @end table 1029 @end table
1030 @end defun 1030 @end defun
1031 1031
1032 @node Changing File Attributes 1032 @node Changing File Attributes, File Names, Information about Files, Files
1033 @section Changing File Names and Attributes 1033 @section Changing File Names and Attributes
1034 @cindex renaming files 1034 @cindex renaming files
1035 @cindex copying files 1035 @cindex copying files
1036 @cindex deleting files 1036 @cindex deleting files
1037 @cindex linking files 1037 @cindex linking files
1207 On MS-DOS, there is no such thing as an ``executable'' file mode bit. 1207 On MS-DOS, there is no such thing as an ``executable'' file mode bit.
1208 So Emacs considers a file executable if its name ends in @samp{.com}, 1208 So Emacs considers a file executable if its name ends in @samp{.com},
1209 @samp{.bat} or @samp{.exe}. This is reflected in the values returned 1209 @samp{.bat} or @samp{.exe}. This is reflected in the values returned
1210 by @code{file-modes} and @code{file-attributes}. 1210 by @code{file-modes} and @code{file-attributes}.
1211 1211
1212 @node File Names 1212 @node File Names, Contents of Directories, Changing File Attributes, Files
1213 @section File Names 1213 @section File Names
1214 @cindex file names 1214 @cindex file names
1215 1215
1216 Files are generally referred to by their names, in XEmacs as elsewhere. 1216 Files are generally referred to by their names, in XEmacs as elsewhere.
1217 File names in XEmacs are represented as strings. The functions that 1217 File names in XEmacs are represented as strings. The functions that
1240 * Unique File Names:: Generating names for temporary files. 1240 * Unique File Names:: Generating names for temporary files.
1241 * File Name Completion:: Finding the completions for a given file name. 1241 * File Name Completion:: Finding the completions for a given file name.
1242 * User Name Completion:: Finding the completions for a given user name. 1242 * User Name Completion:: Finding the completions for a given user name.
1243 @end menu 1243 @end menu
1244 1244
1245 @node File Name Components 1245 @node File Name Components, Directory Names, File Names, File Names
1246 @subsection File Name Components 1246 @subsection File Name Components
1247 @cindex directory part (of file name) 1247 @cindex directory part (of file name)
1248 @cindex nondirectory part (of file name) 1248 @cindex nondirectory part (of file name)
1249 @cindex version number (in file name) 1249 @cindex version number (in file name)
1250 1250
1329 (file-name-sans-extension "big.hack/foo") 1329 (file-name-sans-extension "big.hack/foo")
1330 @result{} "big.hack/foo" 1330 @result{} "big.hack/foo"
1331 @end example 1331 @end example
1332 @end defun 1332 @end defun
1333 1333
1334 @node Directory Names 1334 @node Directory Names, Relative File Names, File Name Components, File Names
1335 @subsection Directory Names 1335 @subsection Directory Names
1336 @cindex directory name 1336 @cindex directory name
1337 @cindex file name of directory 1337 @cindex file name of directory
1338 1338
1339 A @dfn{directory name} is the name of a directory. A directory is a 1339 A @dfn{directory name} is the name of a directory. A directory is a
1430 @c This function applies abbreviations from @code{directory-abbrev-alist} 1430 @c This function applies abbreviations from @code{directory-abbrev-alist}
1431 @c to its argument, and substitutes @samp{~} for the user's home 1431 @c to its argument, and substitutes @samp{~} for the user's home
1432 @c directory. 1432 @c directory.
1433 @c @end defun 1433 @c @end defun
1434 1434
1435 @node Relative File Names 1435 @node Relative File Names, File Name Expansion, Directory Names, File Names
1436 @subsection Absolute and Relative File Names 1436 @subsection Absolute and Relative File Names
1437 @cindex absolute file name 1437 @cindex absolute file name
1438 @cindex relative file name 1438 @cindex relative file name
1439 1439
1440 All the directories in the file system form a tree starting at the 1440 All the directories in the file system form a tree starting at the
1463 @result{} t 1463 @result{} t
1464 @end group 1464 @end group
1465 @end example 1465 @end example
1466 @end defun 1466 @end defun
1467 1467
1468 @node File Name Expansion 1468 @node File Name Expansion, Unique File Names, Relative File Names, File Names
1469 @subsection Functions that Expand Filenames 1469 @subsection Functions that Expand Filenames
1470 @cindex expansion of file names 1470 @cindex expansion of file names
1471 1471
1472 @dfn{Expansion} of a file name means converting a relative file name 1472 @dfn{Expansion} of a file name means converting a relative file name
1473 to an absolute one. Since this is done relative to a default directory, 1473 to an absolute one. Since this is done relative to a default directory,
1595 @result{} "/xcssun/users/rms/foo" 1595 @result{} "/xcssun/users/rms/foo"
1596 @end group 1596 @end group
1597 @end example 1597 @end example
1598 @end defun 1598 @end defun
1599 1599
1600 @node Unique File Names 1600 @node Unique File Names, File Name Completion, File Name Expansion, File Names
1601 @subsection Generating Unique File Names 1601 @subsection Generating Unique File Names
1602 1602
1603 Some programs need to write temporary files. Here is the usual way to 1603 Some programs need to write temporary files. Here is the usual way to
1604 construct a name for such a file: 1604 construct a name for such a file:
1605 1605
1641 1641
1642 To avoid confusion, each Lisp application should preferably use a unique 1642 To avoid confusion, each Lisp application should preferably use a unique
1643 @var{prefix} to @code{make-temp-name}. 1643 @var{prefix} to @code{make-temp-name}.
1644 @end defun 1644 @end defun
1645 1645
1646 @node File Name Completion 1646 @node File Name Completion, User Name Completion, Unique File Names, File Names
1647 @subsection File Name Completion 1647 @subsection File Name Completion
1648 @cindex file name completion subroutines 1648 @cindex file name completion subroutines
1649 @cindex completion, file name 1649 @cindex completion, file name
1650 1650
1651 This section describes low-level subroutines for completing a file 1651 This section describes low-level subroutines for completing a file
1742 @result{} (".o" ".elc" "~" ".dvi") 1742 @result{} (".o" ".elc" "~" ".dvi")
1743 @end group 1743 @end group
1744 @end example 1744 @end example
1745 @end defopt 1745 @end defopt
1746 1746
1747 @node User Name Completion 1747 @node User Name Completion, , File Name Completion, File Names
1748 @subsection User Name Completion 1748 @subsection User Name Completion
1749 @cindex user name completion subroutines 1749 @cindex user name completion subroutines
1750 @cindex completion, user name 1750 @cindex completion, user name
1751 1751
1752 This section describes low-level subroutines for completing a user 1752 This section describes low-level subroutines for completing a user
1778 @code{user-name-completion}, and a boolean indicating whether that 1778 @code{user-name-completion}, and a boolean indicating whether that
1779 completion was unique. 1779 completion was unique.
1780 @end defun 1780 @end defun
1781 1781
1782 1782
1783 @node Contents of Directories 1783 @node Contents of Directories, Create/Delete Dirs, File Names, Files
1784 @section Contents of Directories 1784 @section Contents of Directories
1785 @cindex directory-oriented functions 1785 @cindex directory-oriented functions
1786 @cindex file names in directory 1786 @cindex file names in directory
1787 1787
1788 A directory is a kind of file that contains other files entered under 1788 A directory is a kind of file that contains other files entered under
1865 @defvar insert-directory-program 1865 @defvar insert-directory-program
1866 This variable's value is the program to run to generate a directory listing 1866 This variable's value is the program to run to generate a directory listing
1867 for the function @code{insert-directory}. 1867 for the function @code{insert-directory}.
1868 @end defvar 1868 @end defvar
1869 1869
1870 @node Create/Delete Dirs 1870 @node Create/Delete Dirs, Magic File Names, Contents of Directories, Files
1871 @section Creating and Deleting Directories 1871 @section Creating and Deleting Directories
1872 @c Emacs 19 features 1872 @c Emacs 19 features
1873 1873
1874 Most XEmacs Lisp file-manipulation functions get errors when used on 1874 Most XEmacs Lisp file-manipulation functions get errors when used on
1875 files that are directories. For example, you cannot delete a directory 1875 files that are directories. For example, you cannot delete a directory
1892 This function deletes the directory named @var{dirname}. The function 1892 This function deletes the directory named @var{dirname}. The function
1893 @code{delete-file} does not work for files that are directories; you 1893 @code{delete-file} does not work for files that are directories; you
1894 must use @code{delete-directory} in that case. 1894 must use @code{delete-directory} in that case.
1895 @end deffn 1895 @end deffn
1896 1896
1897 @node Magic File Names 1897 @node Magic File Names, Partial Files, Create/Delete Dirs, Files
1898 @section Making Certain File Names ``Magic'' 1898 @section Making Certain File Names ``Magic''
1899 @cindex magic file names 1899 @cindex magic file names
1900 1900
1901 @c Emacs 19 feature 1901 @c Emacs 19 feature
1902 You can implement special handling for certain file names. This is 1902 You can implement special handling for certain file names. This is
2037 This is useful for running a subprocess; every subprocess must have a 2037 This is useful for running a subprocess; every subprocess must have a
2038 non-magic directory to serve as its current directory, and this function 2038 non-magic directory to serve as its current directory, and this function
2039 is a good way to come up with one. 2039 is a good way to come up with one.
2040 @end defun 2040 @end defun
2041 2041
2042 @node Partial Files 2042 @node Partial Files, Format Conversion, Magic File Names, Files
2043 @section Partial Files 2043 @section Partial Files
2044 @cindex partial files 2044 @cindex partial files
2045 2045
2046 @menu 2046 @menu
2047 * Intro to Partial Files:: 2047 * Intro to Partial Files::
2048 * Creating a Partial File:: 2048 * Creating a Partial File::
2049 * Detached Partial Files:: 2049 * Detached Partial Files::
2050 @end menu 2050 @end menu
2051 2051
2052 @node Intro to Partial Files 2052 @node Intro to Partial Files, Creating a Partial File, Partial Files, Partial Files
2053 @subsection Intro to Partial Files 2053 @subsection Intro to Partial Files
2054 2054
2055 A @dfn{partial file} is a section of a buffer (called the @dfn{master 2055 A @dfn{partial file} is a section of a buffer (called the @dfn{master
2056 buffer}) that is placed in its own buffer and treated as its own file. 2056 buffer}) that is placed in its own buffer and treated as its own file.
2057 Changes made to the partial file are not reflected in the master buffer 2057 Changes made to the partial file are not reflected in the master buffer
2071 2071
2072 When a partial file buffer is first modified, the master buffer is 2072 When a partial file buffer is first modified, the master buffer is
2073 automatically marked as modified so that saving the master buffer will 2073 automatically marked as modified so that saving the master buffer will
2074 work correctly. 2074 work correctly.
2075 2075
2076 @node Creating a Partial File 2076 @node Creating a Partial File, Detached Partial Files, Intro to Partial Files, Partial Files
2077 @subsection Creating a Partial File 2077 @subsection Creating a Partial File
2078 2078
2079 @deffn Command make-file-part &optional start end name buffer 2079 @deffn Command make-file-part &optional start end name buffer
2080 Make a file part on buffer @var{buffer} out of the region. Call it 2080 Make a file part on buffer @var{buffer} out of the region. Call it
2081 @var{name}. This command creates a new buffer containing the contents 2081 @var{name}. This command creates a new buffer containing the contents
2089 default to the beginning of @var{buffer}, the end of @var{buffer}, a 2089 default to the beginning of @var{buffer}, the end of @var{buffer}, a
2090 name generated from @var{buffer}'s name, and the current buffer, 2090 name generated from @var{buffer}'s name, and the current buffer,
2091 respectively. 2091 respectively.
2092 @end deffn 2092 @end deffn
2093 2093
2094 @node Detached Partial Files 2094 @node Detached Partial Files, , Creating a Partial File, Partial Files
2095 @subsection Detached Partial Files 2095 @subsection Detached Partial Files
2096 2096
2097 Every partial file has an extent in the master buffer associated with it 2097 Every partial file has an extent in the master buffer associated with it
2098 (called the @dfn{master extent}), marking where in the master buffer the 2098 (called the @dfn{master extent}), marking where in the master buffer the
2099 partial file begins and ends. If the text in master buffer that is 2099 partial file begins and ends. If the text in master buffer that is
2109 this is the case, XEmacs warns the user of this and the master extent is 2109 this is the case, XEmacs warns the user of this and the master extent is
2110 deleted out of the master buffer, disconnecting the file part. The file 2110 deleted out of the master buffer, disconnecting the file part. The file
2111 part's filename is cleared and thus must be explicitly specified if the 2111 part's filename is cleared and thus must be explicitly specified if the
2112 detached file part is to be saved. 2112 detached file part is to be saved.
2113 2113
2114 @node Format Conversion 2114 @node Format Conversion, Files and MS-DOS, Partial Files, Files
2115 @section File Format Conversion 2115 @section File Format Conversion
2116 2116
2117 @cindex file format conversion 2117 @cindex file format conversion
2118 @cindex encoding file formats 2118 @cindex encoding file formats
2119 @cindex decoding file formats 2119 @cindex decoding file formats
2256 @code{buffer-file-format}; but it is used instead of 2256 @code{buffer-file-format}; but it is used instead of
2257 @code{buffer-file-format} for writing auto-save files. This variable 2257 @code{buffer-file-format} for writing auto-save files. This variable
2258 is always local in all buffers. 2258 is always local in all buffers.
2259 @end defvar 2259 @end defvar
2260 2260
2261 @node Files and MS-DOS 2261 @node Files and MS-DOS, , Format Conversion, Files
2262 @section Files and MS-DOS 2262 @section Files and MS-DOS
2263 @cindex MS-DOS file types 2263 @cindex MS-DOS file types
2264 @cindex file types on MS-DOS 2264 @cindex file types on MS-DOS
2265 @cindex text files and binary files 2265 @cindex text files and binary files
2266 @cindex binary files and text files 2266 @cindex binary files and text files