Mercurial > emacs
comparison src/fileio.c @ 14074:f15db8536fdd
(Ffile_name_directory, Ffile_name_nondirectory, Ffile_name_as_directory,
Fdirectory_file_name, Fexpand_file_name, Fsubstitute_in_file_name,
Fcopy_file, Fmake_directory_internal, Fdelete_directory, Fdelete_file,
Frename_file, Fadd_name_to_file, Fdefine_logical_name, Ffile_modes,
Fset_file_modes, Fset_default_file_modes, Fdo_auto_save, Fread_file_name):
Harmonize arguments with documentation.
author | Erik Naggum <erik@naggum.no> |
---|---|
date | Tue, 09 Jan 1996 00:32:04 +0000 |
parents | 621a575db6f7 |
children | 6b1ecb157b48 |
comparison
equal
deleted
inserted
replaced
14073:0df4b4f2a2a1 | 14074:f15db8536fdd |
---|---|
281 return Qnil; | 281 return Qnil; |
282 } | 282 } |
283 | 283 |
284 DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, | 284 DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory, |
285 1, 1, 0, | 285 1, 1, 0, |
286 "Return the directory component in file name NAME.\n\ | 286 "Return the directory component in file name FILENAME.\n\ |
287 Return nil if NAME does not include a directory.\n\ | 287 Return nil if FILENAME does not include a directory.\n\ |
288 Otherwise return a directory spec.\n\ | 288 Otherwise return a directory spec.\n\ |
289 Given a Unix syntax file name, returns a string ending in slash;\n\ | 289 Given a Unix syntax file name, returns a string ending in slash;\n\ |
290 on VMS, perhaps instead a string ending in `:', `]' or `>'.") | 290 on VMS, perhaps instead a string ending in `:', `]' or `>'.") |
291 (file) | 291 (filename) |
292 Lisp_Object file; | 292 Lisp_Object filename; |
293 { | 293 { |
294 register unsigned char *beg; | 294 register unsigned char *beg; |
295 register unsigned char *p; | 295 register unsigned char *p; |
296 Lisp_Object handler; | 296 Lisp_Object handler; |
297 | 297 |
298 CHECK_STRING (file, 0); | 298 CHECK_STRING (filename, 0); |
299 | 299 |
300 /* If the file name has special constructs in it, | 300 /* If the file name has special constructs in it, |
301 call the corresponding file handler. */ | 301 call the corresponding file handler. */ |
302 handler = Ffind_file_name_handler (file, Qfile_name_directory); | 302 handler = Ffind_file_name_handler (filename, Qfile_name_directory); |
303 if (!NILP (handler)) | 303 if (!NILP (handler)) |
304 return call2 (handler, Qfile_name_directory, file); | 304 return call2 (handler, Qfile_name_directory, filename); |
305 | 305 |
306 #ifdef FILE_SYSTEM_CASE | 306 #ifdef FILE_SYSTEM_CASE |
307 file = FILE_SYSTEM_CASE (file); | 307 filename = FILE_SYSTEM_CASE (filename); |
308 #endif | 308 #endif |
309 beg = XSTRING (file)->data; | 309 beg = XSTRING (filename)->data; |
310 p = beg + XSTRING (file)->size; | 310 p = beg + XSTRING (filename)->size; |
311 | 311 |
312 while (p != beg && !IS_ANY_SEP (p[-1]) | 312 while (p != beg && !IS_ANY_SEP (p[-1]) |
313 #ifdef VMS | 313 #ifdef VMS |
314 && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' | 314 && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' |
315 #endif /* VMS */ | 315 #endif /* VMS */ |
349 return make_string (beg, p - beg); | 349 return make_string (beg, p - beg); |
350 } | 350 } |
351 | 351 |
352 DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, Sfile_name_nondirectory, | 352 DEFUN ("file-name-nondirectory", Ffile_name_nondirectory, Sfile_name_nondirectory, |
353 1, 1, 0, | 353 1, 1, 0, |
354 "Return file name NAME sans its directory.\n\ | 354 "Return file name FILENAME sans its directory.\n\ |
355 For example, in a Unix-syntax file name,\n\ | 355 For example, in a Unix-syntax file name,\n\ |
356 this is everything after the last slash,\n\ | 356 this is everything after the last slash,\n\ |
357 or the entire name if it contains no slash.") | 357 or the entire name if it contains no slash.") |
358 (file) | 358 (filename) |
359 Lisp_Object file; | 359 Lisp_Object filename; |
360 { | 360 { |
361 register unsigned char *beg, *p, *end; | 361 register unsigned char *beg, *p, *end; |
362 Lisp_Object handler; | 362 Lisp_Object handler; |
363 | 363 |
364 CHECK_STRING (file, 0); | 364 CHECK_STRING (filename, 0); |
365 | 365 |
366 /* If the file name has special constructs in it, | 366 /* If the file name has special constructs in it, |
367 call the corresponding file handler. */ | 367 call the corresponding file handler. */ |
368 handler = Ffind_file_name_handler (file, Qfile_name_nondirectory); | 368 handler = Ffind_file_name_handler (filename, Qfile_name_nondirectory); |
369 if (!NILP (handler)) | 369 if (!NILP (handler)) |
370 return call2 (handler, Qfile_name_nondirectory, file); | 370 return call2 (handler, Qfile_name_nondirectory, filename); |
371 | 371 |
372 beg = XSTRING (file)->data; | 372 beg = XSTRING (filename)->data; |
373 end = p = beg + XSTRING (file)->size; | 373 end = p = beg + XSTRING (filename)->size; |
374 | 374 |
375 while (p != beg && !IS_ANY_SEP (p[-1]) | 375 while (p != beg && !IS_ANY_SEP (p[-1]) |
376 #ifdef VMS | 376 #ifdef VMS |
377 && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' | 377 && p[-1] != ':' && p[-1] != ']' && p[-1] != '>' |
378 #endif /* VMS */ | 378 #endif /* VMS */ |
667 return 1; | 667 return 1; |
668 } | 668 } |
669 | 669 |
670 DEFUN ("directory-file-name", Fdirectory_file_name, Sdirectory_file_name, | 670 DEFUN ("directory-file-name", Fdirectory_file_name, Sdirectory_file_name, |
671 1, 1, 0, | 671 1, 1, 0, |
672 "Returns the file name of the directory named DIR.\n\ | 672 "Returns the file name of the directory named DIRECTORY.\n\ |
673 This is the name of the file that holds the data for the directory DIR.\n\ | 673 This is the name of the file that holds the data for the directory DIRECTORY.\n\ |
674 This operation exists because a directory is also a file, but its name as\n\ | 674 This operation exists because a directory is also a file, but its name as\n\ |
675 a directory is different from its name as a file.\n\ | 675 a directory is different from its name as a file.\n\ |
676 In Unix-syntax, this function just removes the final slash.\n\ | 676 In Unix-syntax, this function just removes the final slash.\n\ |
677 On VMS, given a VMS-syntax directory name such as \"[X.Y]\",\n\ | 677 On VMS, given a VMS-syntax directory name such as \"[X.Y]\",\n\ |
678 it returns a file name such as \"[X]Y.DIR.1\".") | 678 it returns a file name such as \"[X]Y.DIR.1\".") |
717 mktemp (XSTRING (val)->data); | 717 mktemp (XSTRING (val)->data); |
718 return val; | 718 return val; |
719 } | 719 } |
720 | 720 |
721 DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, | 721 DEFUN ("expand-file-name", Fexpand_file_name, Sexpand_file_name, 1, 2, 0, |
722 "Convert FILENAME to absolute, and canonicalize it.\n\ | 722 "Convert filename NAME to absolute, and canonicalize it.\n\ |
723 Second arg DEFAULT is directory to start with if FILENAME is relative\n\ | 723 Second arg DEFAULT-DIRECTORY is directory to start with if NAME is relative\n\ |
724 (does not start with slash); if DEFAULT is nil or missing,\n\ | 724 (does not start with slash); if DEFAULT-DIRECTORY is nil or missing,\n\ |
725 the current buffer's value of default-directory is used.\n\ | 725 the current buffer's value of default-directory is used.\n\ |
726 Path components that are `.' are removed, and \n\ | 726 Path components that are `.' are removed, and \n\ |
727 path components followed by `..' are removed, along with the `..' itself;\n\ | 727 path components followed by `..' are removed, along with the `..' itself;\n\ |
728 note that these simplifications are done without checking the resulting\n\ | 728 note that these simplifications are done without checking the resulting\n\ |
729 paths in the file system.\n\ | 729 paths in the file system.\n\ |
730 An initial `~/' expands to your home directory.\n\ | 730 An initial `~/' expands to your home directory.\n\ |
731 An initial `~USER/' expands to USER's home directory.\n\ | 731 An initial `~USER/' expands to USER's home directory.\n\ |
732 See also the function `substitute-in-file-name'.") | 732 See also the function `substitute-in-file-name'.") |
733 (name, defalt) | 733 (name, default_directory) |
734 Lisp_Object name, defalt; | 734 Lisp_Object name, default_directory; |
735 { | 735 { |
736 unsigned char *nm; | 736 unsigned char *nm; |
737 | 737 |
738 register unsigned char *newdir, *p, *o; | 738 register unsigned char *newdir, *p, *o; |
739 int tlen; | 739 int tlen; |
759 | 759 |
760 /* If the file name has special constructs in it, | 760 /* If the file name has special constructs in it, |
761 call the corresponding file handler. */ | 761 call the corresponding file handler. */ |
762 handler = Ffind_file_name_handler (name, Qexpand_file_name); | 762 handler = Ffind_file_name_handler (name, Qexpand_file_name); |
763 if (!NILP (handler)) | 763 if (!NILP (handler)) |
764 return call3 (handler, Qexpand_file_name, name, defalt); | 764 return call3 (handler, Qexpand_file_name, name, default_directory); |
765 | 765 |
766 /* Use the buffer's default-directory if DEFALT is omitted. */ | 766 /* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */ |
767 if (NILP (defalt)) | 767 if (NILP (default_directory)) |
768 defalt = current_buffer->directory; | 768 default_directory = current_buffer->directory; |
769 CHECK_STRING (defalt, 1); | 769 CHECK_STRING (default_directory, 1); |
770 | 770 |
771 if (!NILP (defalt)) | 771 if (!NILP (default_directory)) |
772 { | 772 { |
773 handler = Ffind_file_name_handler (defalt, Qexpand_file_name); | 773 handler = Ffind_file_name_handler (default_directory, Qexpand_file_name); |
774 if (!NILP (handler)) | 774 if (!NILP (handler)) |
775 return call3 (handler, Qexpand_file_name, name, defalt); | 775 return call3 (handler, Qexpand_file_name, name, default_directory); |
776 } | 776 } |
777 | 777 |
778 o = XSTRING (defalt)->data; | 778 o = XSTRING (default_directory)->data; |
779 | 779 |
780 /* Make sure DEFALT is properly expanded. | 780 /* Make sure DEFAULT_DIRECTORY is properly expanded. |
781 It would be better to do this down below where we actually use | 781 It would be better to do this down below where we actually use |
782 defalt. Unfortunately, calling Fexpand_file_name recursively | 782 default_directory. Unfortunately, calling Fexpand_file_name recursively |
783 could invoke GC, and the strings might be relocated. This would | 783 could invoke GC, and the strings might be relocated. This would |
784 be annoying because we have pointers into strings lying around | 784 be annoying because we have pointers into strings lying around |
785 that would need adjusting, and people would add new pointers to | 785 that would need adjusting, and people would add new pointers to |
786 the code and forget to adjust them, resulting in intermittent bugs. | 786 the code and forget to adjust them, resulting in intermittent bugs. |
787 Putting this call here avoids all that crud. | 787 Putting this call here avoids all that crud. |
788 | 788 |
789 The EQ test avoids infinite recursion. */ | 789 The EQ test avoids infinite recursion. */ |
790 if (! NILP (defalt) && !EQ (defalt, name) | 790 if (! NILP (default_directory) && !EQ (default_directory, name) |
791 /* This saves time in a common case. */ | 791 /* This saves time in a common case. */ |
792 && ! (XSTRING (defalt)->size >= 3 | 792 && ! (XSTRING (default_directory)->size >= 3 |
793 && IS_DIRECTORY_SEP (XSTRING (defalt)->data[0]) | 793 && IS_DIRECTORY_SEP (XSTRING (default_directory)->data[0]) |
794 && IS_DEVICE_SEP (XSTRING (defalt)->data[1]))) | 794 && IS_DEVICE_SEP (XSTRING (default_directory)->data[1]))) |
795 { | 795 { |
796 struct gcpro gcpro1; | 796 struct gcpro gcpro1; |
797 | 797 |
798 GCPRO1 (name); | 798 GCPRO1 (name); |
799 defalt = Fexpand_file_name (defalt, Qnil); | 799 default_directory = Fexpand_file_name (default_directory, Qnil); |
800 UNGCPRO; | 800 UNGCPRO; |
801 } | 801 } |
802 | 802 |
803 #ifdef VMS | 803 #ifdef VMS |
804 /* Filenames on VMS are always upper case. */ | 804 /* Filenames on VMS are always upper case. */ |
1046 #ifdef DOS_NT | 1046 #ifdef DOS_NT |
1047 && drive == -1 | 1047 && drive == -1 |
1048 #endif /* DOS_NT */ | 1048 #endif /* DOS_NT */ |
1049 && !newdir) | 1049 && !newdir) |
1050 { | 1050 { |
1051 newdir = XSTRING (defalt)->data; | 1051 newdir = XSTRING (default_directory)->data; |
1052 } | 1052 } |
1053 | 1053 |
1054 #ifdef DOS_NT | 1054 #ifdef DOS_NT |
1055 if (newdir == 0 && relpath) | 1055 if (newdir == 0 && relpath) |
1056 newdir = defdir; | 1056 newdir = defdir; |
1554 with a character not a letter, digit or underscore; otherwise, enclose\n\ | 1554 with a character not a letter, digit or underscore; otherwise, enclose\n\ |
1555 the entire variable name in braces.\n\ | 1555 the entire variable name in braces.\n\ |
1556 If `/~' appears, all of FILENAME through that `/' is discarded.\n\n\ | 1556 If `/~' appears, all of FILENAME through that `/' is discarded.\n\n\ |
1557 On VMS, `$' substitution is not done; this function does little and only\n\ | 1557 On VMS, `$' substitution is not done; this function does little and only\n\ |
1558 duplicates what `expand-file-name' does.") | 1558 duplicates what `expand-file-name' does.") |
1559 (string) | 1559 (filename) |
1560 Lisp_Object string; | 1560 Lisp_Object filename; |
1561 { | 1561 { |
1562 unsigned char *nm; | 1562 unsigned char *nm; |
1563 | 1563 |
1564 register unsigned char *s, *p, *o, *x, *endp; | 1564 register unsigned char *s, *p, *o, *x, *endp; |
1565 unsigned char *target; | 1565 unsigned char *target; |
1566 int total = 0; | 1566 int total = 0; |
1567 int substituted = 0; | 1567 int substituted = 0; |
1568 unsigned char *xnm; | 1568 unsigned char *xnm; |
1569 Lisp_Object handler; | 1569 Lisp_Object handler; |
1570 | 1570 |
1571 CHECK_STRING (string, 0); | 1571 CHECK_STRING (filename, 0); |
1572 | 1572 |
1573 /* If the file name has special constructs in it, | 1573 /* If the file name has special constructs in it, |
1574 call the corresponding file handler. */ | 1574 call the corresponding file handler. */ |
1575 handler = Ffind_file_name_handler (string, Qsubstitute_in_file_name); | 1575 handler = Ffind_file_name_handler (filename, Qsubstitute_in_file_name); |
1576 if (!NILP (handler)) | 1576 if (!NILP (handler)) |
1577 return call2 (handler, Qsubstitute_in_file_name, string); | 1577 return call2 (handler, Qsubstitute_in_file_name, filename); |
1578 | 1578 |
1579 nm = XSTRING (string)->data; | 1579 nm = XSTRING (filename)->data; |
1580 #ifdef MSDOS | 1580 #ifdef MSDOS |
1581 dostounix_filename (nm = strcpy (alloca (strlen (nm) + 1), nm)); | 1581 dostounix_filename (nm = strcpy (alloca (strlen (nm) + 1), nm)); |
1582 substituted = !strcmp (nm, XSTRING (string)->data); | 1582 substituted = !strcmp (nm, XSTRING (filename)->data); |
1583 #endif | 1583 #endif |
1584 endp = nm + XSTRING (string)->size; | 1584 endp = nm + XSTRING (filename)->size; |
1585 | 1585 |
1586 /* If /~ or // appears, discard everything through first slash. */ | 1586 /* If /~ or // appears, discard everything through first slash. */ |
1587 | 1587 |
1588 for (p = nm; p != endp; p++) | 1588 for (p = nm; p != endp; p++) |
1589 { | 1589 { |
1669 total += strlen (o); | 1669 total += strlen (o); |
1670 substituted = 1; | 1670 substituted = 1; |
1671 } | 1671 } |
1672 | 1672 |
1673 if (!substituted) | 1673 if (!substituted) |
1674 return string; | 1674 return filename; |
1675 | 1675 |
1676 /* If substitution required, recopy the string and do it */ | 1676 /* If substitution required, recopy the string and do it */ |
1677 /* Make space in stack frame for the new copy */ | 1677 /* Make space in stack frame for the new copy */ |
1678 xnm = (unsigned char *) alloca (XSTRING (string)->size + total + 1); | 1678 xnm = (unsigned char *) alloca (XSTRING (filename)->size + total + 1); |
1679 x = xnm; | 1679 x = xnm; |
1680 | 1680 |
1681 /* Copy the rest of the name through, replacing $ constructs with values */ | 1681 /* Copy the rest of the name through, replacing $ constructs with values */ |
1682 for (p = nm; *p;) | 1682 for (p = nm; *p;) |
1683 if (*p != '$') | 1683 if (*p != '$') |
1842 A number as third arg means request confirmation if NEWNAME already exists.\n\ | 1842 A number as third arg means request confirmation if NEWNAME already exists.\n\ |
1843 This is what happens in interactive use with M-x.\n\ | 1843 This is what happens in interactive use with M-x.\n\ |
1844 Fourth arg KEEP-TIME non-nil means give the new file the same\n\ | 1844 Fourth arg KEEP-TIME non-nil means give the new file the same\n\ |
1845 last-modified time as the old one. (This works on only some systems.)\n\ | 1845 last-modified time as the old one. (This works on only some systems.)\n\ |
1846 A prefix arg makes KEEP-TIME non-nil.") | 1846 A prefix arg makes KEEP-TIME non-nil.") |
1847 (filename, newname, ok_if_already_exists, keep_date) | 1847 (file, newname, ok_if_already_exists, keep_date) |
1848 Lisp_Object filename, newname, ok_if_already_exists, keep_date; | 1848 Lisp_Object file, newname, ok_if_already_exists, keep_date; |
1849 { | 1849 { |
1850 int ifd, ofd, n; | 1850 int ifd, ofd, n; |
1851 char buf[16 * 1024]; | 1851 char buf[16 * 1024]; |
1852 struct stat st, out_st; | 1852 struct stat st, out_st; |
1853 Lisp_Object handler; | 1853 Lisp_Object handler; |
1854 struct gcpro gcpro1, gcpro2; | 1854 struct gcpro gcpro1, gcpro2; |
1855 int count = specpdl_ptr - specpdl; | 1855 int count = specpdl_ptr - specpdl; |
1856 int input_file_statable_p; | 1856 int input_file_statable_p; |
1857 | 1857 |
1858 GCPRO2 (filename, newname); | 1858 GCPRO2 (file, newname); |
1859 CHECK_STRING (filename, 0); | 1859 CHECK_STRING (file, 0); |
1860 CHECK_STRING (newname, 1); | 1860 CHECK_STRING (newname, 1); |
1861 filename = Fexpand_file_name (filename, Qnil); | 1861 file = Fexpand_file_name (file, Qnil); |
1862 newname = Fexpand_file_name (newname, Qnil); | 1862 newname = Fexpand_file_name (newname, Qnil); |
1863 | 1863 |
1864 /* If the input file name has special constructs in it, | 1864 /* If the input file name has special constructs in it, |
1865 call the corresponding file handler. */ | 1865 call the corresponding file handler. */ |
1866 handler = Ffind_file_name_handler (filename, Qcopy_file); | 1866 handler = Ffind_file_name_handler (file, Qcopy_file); |
1867 /* Likewise for output file name. */ | 1867 /* Likewise for output file name. */ |
1868 if (NILP (handler)) | 1868 if (NILP (handler)) |
1869 handler = Ffind_file_name_handler (newname, Qcopy_file); | 1869 handler = Ffind_file_name_handler (newname, Qcopy_file); |
1870 if (!NILP (handler)) | 1870 if (!NILP (handler)) |
1871 RETURN_UNGCPRO (call5 (handler, Qcopy_file, filename, newname, | 1871 RETURN_UNGCPRO (call5 (handler, Qcopy_file, file, newname, |
1872 ok_if_already_exists, keep_date)); | 1872 ok_if_already_exists, keep_date)); |
1873 | 1873 |
1874 if (NILP (ok_if_already_exists) | 1874 if (NILP (ok_if_already_exists) |
1875 || INTEGERP (ok_if_already_exists)) | 1875 || INTEGERP (ok_if_already_exists)) |
1876 barf_or_query_if_file_exists (newname, "copy to it", | 1876 barf_or_query_if_file_exists (newname, "copy to it", |
1877 INTEGERP (ok_if_already_exists), &out_st); | 1877 INTEGERP (ok_if_already_exists), &out_st); |
1878 else if (stat (XSTRING (newname)->data, &out_st) < 0) | 1878 else if (stat (XSTRING (newname)->data, &out_st) < 0) |
1879 out_st.st_mode = 0; | 1879 out_st.st_mode = 0; |
1880 | 1880 |
1881 ifd = open (XSTRING (filename)->data, O_RDONLY); | 1881 ifd = open (XSTRING (file)->data, O_RDONLY); |
1882 if (ifd < 0) | 1882 if (ifd < 0) |
1883 report_file_error ("Opening input file", Fcons (filename, Qnil)); | 1883 report_file_error ("Opening input file", Fcons (file, Qnil)); |
1884 | 1884 |
1885 record_unwind_protect (close_file_unwind, make_number (ifd)); | 1885 record_unwind_protect (close_file_unwind, make_number (ifd)); |
1886 | 1886 |
1887 /* We can only copy regular files and symbolic links. Other files are not | 1887 /* We can only copy regular files and symbolic links. Other files are not |
1888 copyable by us. */ | 1888 copyable by us. */ |
1892 if (out_st.st_mode != 0 | 1892 if (out_st.st_mode != 0 |
1893 && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) | 1893 && st.st_dev == out_st.st_dev && st.st_ino == out_st.st_ino) |
1894 { | 1894 { |
1895 errno = 0; | 1895 errno = 0; |
1896 report_file_error ("Input and output files are the same", | 1896 report_file_error ("Input and output files are the same", |
1897 Fcons (filename, Fcons (newname, Qnil))); | 1897 Fcons (file, Fcons (newname, Qnil))); |
1898 } | 1898 } |
1899 #endif | 1899 #endif |
1900 | 1900 |
1901 #if defined (S_ISREG) && defined (S_ISLNK) | 1901 #if defined (S_ISREG) && defined (S_ISLNK) |
1902 if (input_file_statable_p) | 1902 if (input_file_statable_p) |
1905 { | 1905 { |
1906 #if defined (EISDIR) | 1906 #if defined (EISDIR) |
1907 /* Get a better looking error message. */ | 1907 /* Get a better looking error message. */ |
1908 errno = EISDIR; | 1908 errno = EISDIR; |
1909 #endif /* EISDIR */ | 1909 #endif /* EISDIR */ |
1910 report_file_error ("Non-regular file", Fcons (filename, Qnil)); | 1910 report_file_error ("Non-regular file", Fcons (file, Qnil)); |
1911 } | 1911 } |
1912 } | 1912 } |
1913 #endif /* S_ISREG && S_ISLNK */ | 1913 #endif /* S_ISREG && S_ISLNK */ |
1914 | 1914 |
1915 #ifdef VMS | 1915 #ifdef VMS |
1972 return Qnil; | 1972 return Qnil; |
1973 } | 1973 } |
1974 | 1974 |
1975 DEFUN ("make-directory-internal", Fmake_directory_internal, | 1975 DEFUN ("make-directory-internal", Fmake_directory_internal, |
1976 Smake_directory_internal, 1, 1, 0, | 1976 Smake_directory_internal, 1, 1, 0, |
1977 "Create a directory. One argument, a file name string.") | 1977 "Create a new directory named DIRECTORY.") |
1978 (dirname) | 1978 (directory) |
1979 Lisp_Object dirname; | 1979 Lisp_Object directory; |
1980 { | 1980 { |
1981 unsigned char *dir; | 1981 unsigned char *dir; |
1982 Lisp_Object handler; | 1982 Lisp_Object handler; |
1983 | 1983 |
1984 CHECK_STRING (dirname, 0); | 1984 CHECK_STRING (directory, 0); |
1985 dirname = Fexpand_file_name (dirname, Qnil); | 1985 directory = Fexpand_file_name (directory, Qnil); |
1986 | 1986 |
1987 handler = Ffind_file_name_handler (dirname, Qmake_directory_internal); | 1987 handler = Ffind_file_name_handler (directory, Qmake_directory_internal); |
1988 if (!NILP (handler)) | 1988 if (!NILP (handler)) |
1989 return call2 (handler, Qmake_directory_internal, dirname); | 1989 return call2 (handler, Qmake_directory_internal, directory); |
1990 | 1990 |
1991 dir = XSTRING (dirname)->data; | 1991 dir = XSTRING (directory)->data; |
1992 | 1992 |
1993 #ifdef WINDOWSNT | 1993 #ifdef WINDOWSNT |
1994 if (mkdir (dir) != 0) | 1994 if (mkdir (dir) != 0) |
1995 #else | 1995 #else |
1996 if (mkdir (dir, 0777) != 0) | 1996 if (mkdir (dir, 0777) != 0) |
1997 #endif | 1997 #endif |
1998 report_file_error ("Creating directory", Flist (1, &dirname)); | 1998 report_file_error ("Creating directory", Flist (1, &directory)); |
1999 | 1999 |
2000 return Qnil; | 2000 return Qnil; |
2001 } | 2001 } |
2002 | 2002 |
2003 DEFUN ("delete-directory", Fdelete_directory, Sdelete_directory, 1, 1, "FDelete directory: ", | 2003 DEFUN ("delete-directory", Fdelete_directory, Sdelete_directory, 1, 1, "FDelete directory: ", |
2004 "Delete a directory. One argument, a file name or directory name string.") | 2004 "Delete the directory named DIRECTORY.") |
2005 (dirname) | 2005 (directory) |
2006 Lisp_Object dirname; | 2006 Lisp_Object directory; |
2007 { | 2007 { |
2008 unsigned char *dir; | 2008 unsigned char *dir; |
2009 Lisp_Object handler; | 2009 Lisp_Object handler; |
2010 | 2010 |
2011 CHECK_STRING (dirname, 0); | 2011 CHECK_STRING (directory, 0); |
2012 dirname = Fdirectory_file_name (Fexpand_file_name (dirname, Qnil)); | 2012 directory = Fdirectory_file_name (Fexpand_file_name (directory, Qnil)); |
2013 dir = XSTRING (dirname)->data; | 2013 dir = XSTRING (directory)->data; |
2014 | 2014 |
2015 handler = Ffind_file_name_handler (dirname, Qdelete_directory); | 2015 handler = Ffind_file_name_handler (directory, Qdelete_directory); |
2016 if (!NILP (handler)) | 2016 if (!NILP (handler)) |
2017 return call2 (handler, Qdelete_directory, dirname); | 2017 return call2 (handler, Qdelete_directory, directory); |
2018 | 2018 |
2019 if (rmdir (dir) != 0) | 2019 if (rmdir (dir) != 0) |
2020 report_file_error ("Removing directory", Flist (1, &dirname)); | 2020 report_file_error ("Removing directory", Flist (1, &directory)); |
2021 | 2021 |
2022 return Qnil; | 2022 return Qnil; |
2023 } | 2023 } |
2024 | 2024 |
2025 DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 1, "fDelete file: ", | 2025 DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 1, "fDelete file: ", |
2026 "Delete specified file. One argument, a file name string.\n\ | 2026 "Delete file named FILENAME.\n\ |
2027 If file has multiple names, it continues to exist with the other names.") | 2027 If file has multiple names, it continues to exist with the other names.") |
2028 (filename) | 2028 (filename) |
2029 Lisp_Object filename; | 2029 Lisp_Object filename; |
2030 { | 2030 { |
2031 Lisp_Object handler; | 2031 Lisp_Object handler; |
2064 If file has names other than FILE, it continues to have those names.\n\ | 2064 If file has names other than FILE, it continues to have those names.\n\ |
2065 Signals a `file-already-exists' error if a file NEWNAME already exists\n\ | 2065 Signals a `file-already-exists' error if a file NEWNAME already exists\n\ |
2066 unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.\n\ | 2066 unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.\n\ |
2067 A number as third arg means request confirmation if NEWNAME already exists.\n\ | 2067 A number as third arg means request confirmation if NEWNAME already exists.\n\ |
2068 This is what happens in interactive use with M-x.") | 2068 This is what happens in interactive use with M-x.") |
2069 (filename, newname, ok_if_already_exists) | 2069 (file, newname, ok_if_already_exists) |
2070 Lisp_Object filename, newname, ok_if_already_exists; | 2070 Lisp_Object file, newname, ok_if_already_exists; |
2071 { | 2071 { |
2072 #ifdef NO_ARG_ARRAY | 2072 #ifdef NO_ARG_ARRAY |
2073 Lisp_Object args[2]; | 2073 Lisp_Object args[2]; |
2074 #endif | 2074 #endif |
2075 Lisp_Object handler; | 2075 Lisp_Object handler; |
2076 struct gcpro gcpro1, gcpro2; | 2076 struct gcpro gcpro1, gcpro2; |
2077 | 2077 |
2078 GCPRO2 (filename, newname); | 2078 GCPRO2 (file, newname); |
2079 CHECK_STRING (filename, 0); | 2079 CHECK_STRING (file, 0); |
2080 CHECK_STRING (newname, 1); | 2080 CHECK_STRING (newname, 1); |
2081 filename = Fexpand_file_name (filename, Qnil); | 2081 file = Fexpand_file_name (file, Qnil); |
2082 newname = Fexpand_file_name (newname, Qnil); | 2082 newname = Fexpand_file_name (newname, Qnil); |
2083 | 2083 |
2084 /* If the file name has special constructs in it, | 2084 /* If the file name has special constructs in it, |
2085 call the corresponding file handler. */ | 2085 call the corresponding file handler. */ |
2086 handler = Ffind_file_name_handler (filename, Qrename_file); | 2086 handler = Ffind_file_name_handler (file, Qrename_file); |
2087 if (NILP (handler)) | 2087 if (NILP (handler)) |
2088 handler = Ffind_file_name_handler (newname, Qrename_file); | 2088 handler = Ffind_file_name_handler (newname, Qrename_file); |
2089 if (!NILP (handler)) | 2089 if (!NILP (handler)) |
2090 RETURN_UNGCPRO (call4 (handler, Qrename_file, | 2090 RETURN_UNGCPRO (call4 (handler, Qrename_file, |
2091 filename, newname, ok_if_already_exists)); | 2091 file, newname, ok_if_already_exists)); |
2092 | 2092 |
2093 if (NILP (ok_if_already_exists) | 2093 if (NILP (ok_if_already_exists) |
2094 || INTEGERP (ok_if_already_exists)) | 2094 || INTEGERP (ok_if_already_exists)) |
2095 barf_or_query_if_file_exists (newname, "rename to it", | 2095 barf_or_query_if_file_exists (newname, "rename to it", |
2096 INTEGERP (ok_if_already_exists), 0); | 2096 INTEGERP (ok_if_already_exists), 0); |
2097 #ifndef BSD4_1 | 2097 #ifndef BSD4_1 |
2098 if (0 > rename (XSTRING (filename)->data, XSTRING (newname)->data)) | 2098 if (0 > rename (XSTRING (file)->data, XSTRING (newname)->data)) |
2099 #else | 2099 #else |
2100 #ifdef WINDOWSNT | 2100 #ifdef WINDOWSNT |
2101 if (!MoveFile (XSTRING (filename)->data, XSTRING (newname)->data)) | 2101 if (!MoveFile (XSTRING (file)->data, XSTRING (newname)->data)) |
2102 #else /* not WINDOWSNT */ | 2102 #else /* not WINDOWSNT */ |
2103 if (0 > link (XSTRING (filename)->data, XSTRING (newname)->data) | 2103 if (0 > link (XSTRING (file)->data, XSTRING (newname)->data) |
2104 || 0 > unlink (XSTRING (filename)->data)) | 2104 || 0 > unlink (XSTRING (file)->data)) |
2105 #endif /* not WINDOWSNT */ | 2105 #endif /* not WINDOWSNT */ |
2106 #endif | 2106 #endif |
2107 { | 2107 { |
2108 #ifdef WINDOWSNT | 2108 #ifdef WINDOWSNT |
2109 /* Why two? And why doesn't MS document what MoveFile will return? */ | 2109 /* Why two? And why doesn't MS document what MoveFile will return? */ |
2111 || GetLastError () == ERROR_ALREADY_EXISTS) | 2111 || GetLastError () == ERROR_ALREADY_EXISTS) |
2112 #else /* not WINDOWSNT */ | 2112 #else /* not WINDOWSNT */ |
2113 if (errno == EXDEV) | 2113 if (errno == EXDEV) |
2114 #endif /* not WINDOWSNT */ | 2114 #endif /* not WINDOWSNT */ |
2115 { | 2115 { |
2116 Fcopy_file (filename, newname, | 2116 Fcopy_file (file, newname, |
2117 /* We have already prompted if it was an integer, | 2117 /* We have already prompted if it was an integer, |
2118 so don't have copy-file prompt again. */ | 2118 so don't have copy-file prompt again. */ |
2119 NILP (ok_if_already_exists) ? Qnil : Qt, Qt); | 2119 NILP (ok_if_already_exists) ? Qnil : Qt, Qt); |
2120 Fdelete_file (filename); | 2120 Fdelete_file (file); |
2121 } | 2121 } |
2122 else | 2122 else |
2123 #ifdef NO_ARG_ARRAY | 2123 #ifdef NO_ARG_ARRAY |
2124 { | 2124 { |
2125 args[0] = filename; | 2125 args[0] = file; |
2126 args[1] = newname; | 2126 args[1] = newname; |
2127 report_file_error ("Renaming", Flist (2, args)); | 2127 report_file_error ("Renaming", Flist (2, args)); |
2128 } | 2128 } |
2129 #else | 2129 #else |
2130 report_file_error ("Renaming", Flist (2, &filename)); | 2130 report_file_error ("Renaming", Flist (2, &file)); |
2131 #endif | 2131 #endif |
2132 } | 2132 } |
2133 UNGCPRO; | 2133 UNGCPRO; |
2134 return Qnil; | 2134 return Qnil; |
2135 } | 2135 } |
2139 "Give FILE additional name NEWNAME. Both args strings.\n\ | 2139 "Give FILE additional name NEWNAME. Both args strings.\n\ |
2140 Signals a `file-already-exists' error if a file NEWNAME already exists\n\ | 2140 Signals a `file-already-exists' error if a file NEWNAME already exists\n\ |
2141 unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.\n\ | 2141 unless optional third argument OK-IF-ALREADY-EXISTS is non-nil.\n\ |
2142 A number as third arg means request confirmation if NEWNAME already exists.\n\ | 2142 A number as third arg means request confirmation if NEWNAME already exists.\n\ |
2143 This is what happens in interactive use with M-x.") | 2143 This is what happens in interactive use with M-x.") |
2144 (filename, newname, ok_if_already_exists) | 2144 (file, newname, ok_if_already_exists) |
2145 Lisp_Object filename, newname, ok_if_already_exists; | 2145 Lisp_Object file, newname, ok_if_already_exists; |
2146 { | 2146 { |
2147 #ifdef NO_ARG_ARRAY | 2147 #ifdef NO_ARG_ARRAY |
2148 Lisp_Object args[2]; | 2148 Lisp_Object args[2]; |
2149 #endif | 2149 #endif |
2150 Lisp_Object handler; | 2150 Lisp_Object handler; |
2151 struct gcpro gcpro1, gcpro2; | 2151 struct gcpro gcpro1, gcpro2; |
2152 | 2152 |
2153 GCPRO2 (filename, newname); | 2153 GCPRO2 (file, newname); |
2154 CHECK_STRING (filename, 0); | 2154 CHECK_STRING (file, 0); |
2155 CHECK_STRING (newname, 1); | 2155 CHECK_STRING (newname, 1); |
2156 filename = Fexpand_file_name (filename, Qnil); | 2156 file = Fexpand_file_name (file, Qnil); |
2157 newname = Fexpand_file_name (newname, Qnil); | 2157 newname = Fexpand_file_name (newname, Qnil); |
2158 | 2158 |
2159 /* If the file name has special constructs in it, | 2159 /* If the file name has special constructs in it, |
2160 call the corresponding file handler. */ | 2160 call the corresponding file handler. */ |
2161 handler = Ffind_file_name_handler (filename, Qadd_name_to_file); | 2161 handler = Ffind_file_name_handler (file, Qadd_name_to_file); |
2162 if (!NILP (handler)) | 2162 if (!NILP (handler)) |
2163 RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, filename, | 2163 RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, file, |
2164 newname, ok_if_already_exists)); | 2164 newname, ok_if_already_exists)); |
2165 | 2165 |
2166 /* If the new name has special constructs in it, | 2166 /* If the new name has special constructs in it, |
2167 call the corresponding file handler. */ | 2167 call the corresponding file handler. */ |
2168 handler = Ffind_file_name_handler (newname, Qadd_name_to_file); | 2168 handler = Ffind_file_name_handler (newname, Qadd_name_to_file); |
2169 if (!NILP (handler)) | 2169 if (!NILP (handler)) |
2170 RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, filename, | 2170 RETURN_UNGCPRO (call4 (handler, Qadd_name_to_file, file, |
2171 newname, ok_if_already_exists)); | 2171 newname, ok_if_already_exists)); |
2172 | 2172 |
2173 if (NILP (ok_if_already_exists) | 2173 if (NILP (ok_if_already_exists) |
2174 || INTEGERP (ok_if_already_exists)) | 2174 || INTEGERP (ok_if_already_exists)) |
2175 barf_or_query_if_file_exists (newname, "make it a new name", | 2175 barf_or_query_if_file_exists (newname, "make it a new name", |
2176 INTEGERP (ok_if_already_exists), 0); | 2176 INTEGERP (ok_if_already_exists), 0); |
2177 #ifdef WINDOWSNT | 2177 #ifdef WINDOWSNT |
2178 /* Windows does not support this operation. */ | 2178 /* Windows does not support this operation. */ |
2179 report_file_error ("Adding new name", Flist (2, &filename)); | 2179 report_file_error ("Adding new name", Flist (2, &file)); |
2180 #else /* not WINDOWSNT */ | 2180 #else /* not WINDOWSNT */ |
2181 | 2181 |
2182 unlink (XSTRING (newname)->data); | 2182 unlink (XSTRING (newname)->data); |
2183 if (0 > link (XSTRING (filename)->data, XSTRING (newname)->data)) | 2183 if (0 > link (XSTRING (file)->data, XSTRING (newname)->data)) |
2184 { | 2184 { |
2185 #ifdef NO_ARG_ARRAY | 2185 #ifdef NO_ARG_ARRAY |
2186 args[0] = filename; | 2186 args[0] = file; |
2187 args[1] = newname; | 2187 args[1] = newname; |
2188 report_file_error ("Adding new name", Flist (2, args)); | 2188 report_file_error ("Adding new name", Flist (2, args)); |
2189 #else | 2189 #else |
2190 report_file_error ("Adding new name", Flist (2, &filename)); | 2190 report_file_error ("Adding new name", Flist (2, &file)); |
2191 #endif | 2191 #endif |
2192 } | 2192 } |
2193 #endif /* not WINDOWSNT */ | 2193 #endif /* not WINDOWSNT */ |
2194 | 2194 |
2195 UNGCPRO; | 2195 UNGCPRO; |
2271 | 2271 |
2272 DEFUN ("define-logical-name", Fdefine_logical_name, Sdefine_logical_name, | 2272 DEFUN ("define-logical-name", Fdefine_logical_name, Sdefine_logical_name, |
2273 2, 2, "sDefine logical name: \nsDefine logical name %s as: ", | 2273 2, 2, "sDefine logical name: \nsDefine logical name %s as: ", |
2274 "Define the job-wide logical name NAME to have the value STRING.\n\ | 2274 "Define the job-wide logical name NAME to have the value STRING.\n\ |
2275 If STRING is nil or a null string, the logical name NAME is deleted.") | 2275 If STRING is nil or a null string, the logical name NAME is deleted.") |
2276 (varname, string) | 2276 (name, string) |
2277 Lisp_Object varname; | 2277 Lisp_Object name; |
2278 Lisp_Object string; | 2278 Lisp_Object string; |
2279 { | 2279 { |
2280 CHECK_STRING (varname, 0); | 2280 CHECK_STRING (name, 0); |
2281 if (NILP (string)) | 2281 if (NILP (string)) |
2282 delete_logical_name (XSTRING (varname)->data); | 2282 delete_logical_name (XSTRING (name)->data); |
2283 else | 2283 else |
2284 { | 2284 { |
2285 CHECK_STRING (string, 1); | 2285 CHECK_STRING (string, 1); |
2286 | 2286 |
2287 if (XSTRING (string)->size == 0) | 2287 if (XSTRING (string)->size == 0) |
2288 delete_logical_name (XSTRING (varname)->data); | 2288 delete_logical_name (XSTRING (name)->data); |
2289 else | 2289 else |
2290 define_logical_name (XSTRING (varname)->data, XSTRING (string)->data); | 2290 define_logical_name (XSTRING (name)->data, XSTRING (string)->data); |
2291 } | 2291 } |
2292 | 2292 |
2293 return string; | 2293 return string; |
2294 } | 2294 } |
2295 #endif /* VMS */ | 2295 #endif /* VMS */ |
2637 return Qnil; | 2637 return Qnil; |
2638 return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; | 2638 return (st.st_mode & S_IFMT) == S_IFREG ? Qt : Qnil; |
2639 } | 2639 } |
2640 | 2640 |
2641 DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, | 2641 DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, |
2642 "Return mode bits of FILE, as an integer.") | 2642 "Return mode bits of file named FILENAME, as an integer.") |
2643 (filename) | 2643 (filename) |
2644 Lisp_Object filename; | 2644 Lisp_Object filename; |
2645 { | 2645 { |
2646 Lisp_Object abspath; | 2646 Lisp_Object abspath; |
2647 struct stat st; | 2647 struct stat st; |
2664 | 2664 |
2665 return make_number (st.st_mode & 07777); | 2665 return make_number (st.st_mode & 07777); |
2666 } | 2666 } |
2667 | 2667 |
2668 DEFUN ("set-file-modes", Fset_file_modes, Sset_file_modes, 2, 2, 0, | 2668 DEFUN ("set-file-modes", Fset_file_modes, Sset_file_modes, 2, 2, 0, |
2669 "Set mode bits of FILE to MODE (an integer).\n\ | 2669 "Set mode bits of file named FILENAME to MODE (an integer).\n\ |
2670 Only the 12 low bits of MODE are used.") | 2670 Only the 12 low bits of MODE are used.") |
2671 (filename, mode) | 2671 (filename, mode) |
2672 Lisp_Object filename, mode; | 2672 Lisp_Object filename, mode; |
2673 { | 2673 { |
2674 Lisp_Object abspath; | 2674 Lisp_Object abspath; |
3837 and are changed since last auto-saved.\n\ | 3837 and are changed since last auto-saved.\n\ |
3838 Auto-saving writes the buffer into a file\n\ | 3838 Auto-saving writes the buffer into a file\n\ |
3839 so that your editing is not lost if the system crashes.\n\ | 3839 so that your editing is not lost if the system crashes.\n\ |
3840 This file is not the file you visited; that changes only when you save.\n\ | 3840 This file is not the file you visited; that changes only when you save.\n\ |
3841 Normally we run the normal hook `auto-save-hook' before saving.\n\n\ | 3841 Normally we run the normal hook `auto-save-hook' before saving.\n\n\ |
3842 Non-nil first argument means do not print any message if successful.\n\ | 3842 A non-nil NO-MESSAGE argument means do not print any message if successful.\n\ |
3843 Non-nil second argument means save only current buffer.") | 3843 A non-nil CURRENT-ONLY argument means save only current buffer.") |
3844 (no_message, current_only) | 3844 (no_message, current_only) |
3845 Lisp_Object no_message, current_only; | 3845 Lisp_Object no_message, current_only; |
3846 { | 3846 { |
3847 struct buffer *old = current_buffer, *b; | 3847 struct buffer *old = current_buffer, *b; |
3848 Lisp_Object tail, buf; | 3848 Lisp_Object tail, buf; |
4141 } | 4141 } |
4142 | 4142 |
4143 DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 5, 0, | 4143 DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 5, 0, |
4144 "Read file name, prompting with PROMPT and completing in directory DIR.\n\ | 4144 "Read file name, prompting with PROMPT and completing in directory DIR.\n\ |
4145 Value is not expanded---you must call `expand-file-name' yourself.\n\ | 4145 Value is not expanded---you must call `expand-file-name' yourself.\n\ |
4146 Default name to DEFAULT if user enters a null string.\n\ | 4146 Default name to DEFAULT-FILENAME if user enters a null string.\n\ |
4147 (If DEFAULT is omitted, the visited file name is used,\n\ | 4147 (If DEFAULT-FILENAME is omitted, the visited file name is used,\n\ |
4148 except that if INITIAL is specified, that combined with DIR is used.)\n\ | 4148 except that if INITIAL is specified, that combined with DIR is used.)\n\ |
4149 Fourth arg MUSTMATCH non-nil means require existing file's name.\n\ | 4149 Fourth arg MUSTMATCH non-nil means require existing file's name.\n\ |
4150 Non-nil and non-t means also require confirmation after completion.\n\ | 4150 Non-nil and non-t means also require confirmation after completion.\n\ |
4151 Fifth arg INITIAL specifies text to start with.\n\ | 4151 Fifth arg INITIAL specifies text to start with.\n\ |
4152 DIR defaults to current buffer's directory default.") | 4152 DIR defaults to current buffer's directory default.") |
4153 (prompt, dir, defalt, mustmatch, initial) | 4153 (prompt, dir, default_filename, mustmatch, initial) |
4154 Lisp_Object prompt, dir, defalt, mustmatch, initial; | 4154 Lisp_Object prompt, dir, default_filename, mustmatch, initial; |
4155 { | 4155 { |
4156 Lisp_Object val, insdef, insdef1, tem; | 4156 Lisp_Object val, insdef, insdef1, tem; |
4157 struct gcpro gcpro1, gcpro2; | 4157 struct gcpro gcpro1, gcpro2; |
4158 register char *homedir; | 4158 register char *homedir; |
4159 int count; | 4159 int count; |
4160 | 4160 |
4161 if (NILP (dir)) | 4161 if (NILP (dir)) |
4162 dir = current_buffer->directory; | 4162 dir = current_buffer->directory; |
4163 if (NILP (defalt)) | 4163 if (NILP (default_filename)) |
4164 { | 4164 { |
4165 if (! NILP (initial)) | 4165 if (! NILP (initial)) |
4166 defalt = Fexpand_file_name (initial, dir); | 4166 default_filename = Fexpand_file_name (initial, dir); |
4167 else | 4167 else |
4168 defalt = current_buffer->filename; | 4168 default_filename = current_buffer->filename; |
4169 } | 4169 } |
4170 | 4170 |
4171 /* If dir starts with user's homedir, change that to ~. */ | 4171 /* If dir starts with user's homedir, change that to ~. */ |
4172 homedir = (char *) egetenv ("HOME"); | 4172 homedir = (char *) egetenv ("HOME"); |
4173 if (homedir != 0 | 4173 if (homedir != 0 |
4207 #ifdef VMS | 4207 #ifdef VMS |
4208 count = specpdl_ptr - specpdl; | 4208 count = specpdl_ptr - specpdl; |
4209 specbind (intern ("completion-ignore-case"), Qt); | 4209 specbind (intern ("completion-ignore-case"), Qt); |
4210 #endif | 4210 #endif |
4211 | 4211 |
4212 GCPRO2 (insdef, defalt); | 4212 GCPRO2 (insdef, default_filename); |
4213 val = Fcompleting_read (prompt, intern ("read-file-name-internal"), | 4213 val = Fcompleting_read (prompt, intern ("read-file-name-internal"), |
4214 dir, mustmatch, insdef1, | 4214 dir, mustmatch, insdef1, |
4215 Qfile_name_history); | 4215 Qfile_name_history); |
4216 | 4216 |
4217 #ifdef VMS | 4217 #ifdef VMS |
4220 | 4220 |
4221 UNGCPRO; | 4221 UNGCPRO; |
4222 if (NILP (val)) | 4222 if (NILP (val)) |
4223 error ("No file name specified"); | 4223 error ("No file name specified"); |
4224 tem = Fstring_equal (val, insdef); | 4224 tem = Fstring_equal (val, insdef); |
4225 if (!NILP (tem) && !NILP (defalt)) | 4225 if (!NILP (tem) && !NILP (default_filename)) |
4226 return defalt; | 4226 return default_filename; |
4227 if (XSTRING (val)->size == 0 && NILP (insdef)) | 4227 if (XSTRING (val)->size == 0 && NILP (insdef)) |
4228 { | 4228 { |
4229 if (!NILP (defalt)) | 4229 if (!NILP (default_filename)) |
4230 return defalt; | 4230 return default_filename; |
4231 else | 4231 else |
4232 error ("No default file name"); | 4232 error ("No default file name"); |
4233 } | 4233 } |
4234 return Fsubstitute_in_file_name (val); | 4234 return Fsubstitute_in_file_name (val); |
4235 } | 4235 } |