diff options
| author | Miles Bader | 2000-11-13 12:18:37 +0000 |
|---|---|---|
| committer | Miles Bader | 2000-11-13 12:18:37 +0000 |
| commit | 96dc0f4e12535b038c0f87838a03029a3ebb20fa (patch) | |
| tree | ec088a3f9c4fd02d480b8e390e98dbef6abbe1e5 | |
| parent | 27849a6528df4ac2c54db88b287a677edda15253 (diff) | |
| download | emacs-96dc0f4e12535b038c0f87838a03029a3ebb20fa.tar.gz emacs-96dc0f4e12535b038c0f87838a03029a3ebb20fa.zip | |
(openp): Return -2 instead of 0 for the `remote file' case.
(Fload): Use new openp return protocol. Don't try to use
Vload_source_file_function to load .elc files.
| -rw-r--r-- | src/lread.c | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/src/lread.c b/src/lread.c index a7b67523316..14200f80082 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -685,7 +685,7 @@ Return t if file exists.") | |||
| 685 | UNGCPRO; | 685 | UNGCPRO; |
| 686 | } | 686 | } |
| 687 | 687 | ||
| 688 | if (fd < 0) | 688 | if (fd == -1) |
| 689 | { | 689 | { |
| 690 | if (NILP (noerror)) | 690 | if (NILP (noerror)) |
| 691 | while (1) | 691 | while (1) |
| @@ -699,8 +699,8 @@ Return t if file exists.") | |||
| 699 | if (EQ (Qt, Vuser_init_file)) | 699 | if (EQ (Qt, Vuser_init_file)) |
| 700 | Vuser_init_file = found; | 700 | Vuser_init_file = found; |
| 701 | 701 | ||
| 702 | /* If FD is 0, that means openp found a magic file. */ | 702 | /* If FD is -2, that means openp found a magic file. */ |
| 703 | if (fd == 0) | 703 | if (fd == -2) |
| 704 | { | 704 | { |
| 705 | if (NILP (Fequal (found, file))) | 705 | if (NILP (Fequal (found, file))) |
| 706 | /* If FOUND is a different file name from FILE, | 706 | /* If FOUND is a different file name from FILE, |
| @@ -734,44 +734,46 @@ Return t if file exists.") | |||
| 734 | Vloads_in_progress = Fcons (found, Vloads_in_progress); | 734 | Vloads_in_progress = Fcons (found, Vloads_in_progress); |
| 735 | } | 735 | } |
| 736 | 736 | ||
| 737 | /* Load .elc files directly, but not when they are | ||
| 738 | remote and have no handler! */ | ||
| 739 | if (!bcmp (&(XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 4]), | 737 | if (!bcmp (&(XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 4]), |
| 740 | ".elc", 4) | 738 | ".elc", 4)) |
| 741 | && fd != 0) | 739 | /* Load .elc files directly, but not when they are |
| 740 | remote and have no handler! */ | ||
| 742 | { | 741 | { |
| 743 | struct stat s1, s2; | 742 | if (fd != -2) |
| 744 | int result; | ||
| 745 | |||
| 746 | if (!safe_to_load_p (fd)) | ||
| 747 | { | 743 | { |
| 748 | safe_p = 0; | 744 | struct stat s1, s2; |
| 749 | if (!load_dangerous_libraries) | 745 | int result; |
| 750 | error ("File `%s' was not compiled in Emacs", | ||
| 751 | XSTRING (found)->data); | ||
| 752 | else if (!NILP (nomessage)) | ||
| 753 | message_with_string ("File `%s' not compiled in Emacs", found, 1); | ||
| 754 | } | ||
| 755 | 746 | ||
| 756 | compiled = 1; | 747 | if (!safe_to_load_p (fd)) |
| 748 | { | ||
| 749 | safe_p = 0; | ||
| 750 | if (!load_dangerous_libraries) | ||
| 751 | error ("File `%s' was not compiled in Emacs", | ||
| 752 | XSTRING (found)->data); | ||
| 753 | else if (!NILP (nomessage)) | ||
| 754 | message_with_string ("File `%s' not compiled in Emacs", found, 1); | ||
| 755 | } | ||
| 757 | 756 | ||
| 758 | #ifdef DOS_NT | 757 | compiled = 1; |
| 759 | fmode = "rb"; | 758 | |
| 760 | #endif /* DOS_NT */ | 759 | #ifdef DOS_NT |
| 761 | stat ((char *)XSTRING (found)->data, &s1); | 760 | fmode = "rb"; |
| 762 | XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 1] = 0; | 761 | #endif /* DOS_NT */ |
| 763 | result = stat ((char *)XSTRING (found)->data, &s2); | 762 | stat ((char *)XSTRING (found)->data, &s1); |
| 764 | if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime) | 763 | XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 1] = 0; |
| 765 | { | 764 | result = stat ((char *)XSTRING (found)->data, &s2); |
| 766 | /* Make the progress messages mention that source is newer. */ | 765 | if (result >= 0 && (unsigned) s1.st_mtime < (unsigned) s2.st_mtime) |
| 767 | newer = 1; | 766 | { |
| 767 | /* Make the progress messages mention that source is newer. */ | ||
| 768 | newer = 1; | ||
| 768 | 769 | ||
| 769 | /* If we won't print another message, mention this anyway. */ | 770 | /* If we won't print another message, mention this anyway. */ |
| 770 | if (! NILP (nomessage)) | 771 | if (! NILP (nomessage)) |
| 771 | message_with_string ("Source file `%s' newer than byte-compiled file", | 772 | message_with_string ("Source file `%s' newer than byte-compiled file", |
| 772 | found, 1); | 773 | found, 1); |
| 774 | } | ||
| 775 | XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 1] = 'c'; | ||
| 773 | } | 776 | } |
| 774 | XSTRING (found)->data[STRING_BYTES (XSTRING (found)) - 1] = 'c'; | ||
| 775 | } | 777 | } |
| 776 | else | 778 | else |
| 777 | { | 779 | { |
| @@ -781,8 +783,8 @@ Return t if file exists.") | |||
| 781 | if (!NILP (Vload_source_file_function)) | 783 | if (!NILP (Vload_source_file_function)) |
| 782 | { | 784 | { |
| 783 | Lisp_Object val; | 785 | Lisp_Object val; |
| 784 | 786 | ||
| 785 | if (fd != 0) | 787 | if (fd >= 0) |
| 786 | emacs_close (fd); | 788 | emacs_close (fd); |
| 787 | val = call4 (Vload_source_file_function, found, file, | 789 | val = call4 (Vload_source_file_function, found, file, |
| 788 | NILP (noerror) ? Qnil : Qt, | 790 | NILP (noerror) ? Qnil : Qt, |
| @@ -928,7 +930,7 @@ complete_filename_p (pathname) | |||
| 928 | the file actually found should be stored as a Lisp string. | 930 | the file actually found should be stored as a Lisp string. |
| 929 | nil is stored there on failure. | 931 | nil is stored there on failure. |
| 930 | 932 | ||
| 931 | If the file we find is remote, return 0 | 933 | If the file we find is remote, return -2 |
| 932 | but store the found remote file name in *STOREPTR. | 934 | but store the found remote file name in *STOREPTR. |
| 933 | We do not check for remote files if EXEC_ONLY is nonzero. */ | 935 | We do not check for remote files if EXEC_ONLY is nonzero. */ |
| 934 | 936 | ||
| @@ -1032,7 +1034,7 @@ openp (path, str, suffix, storeptr, exec_only) | |||
| 1032 | if (storeptr) | 1034 | if (storeptr) |
| 1033 | *storeptr = build_string (fn); | 1035 | *storeptr = build_string (fn); |
| 1034 | UNGCPRO; | 1036 | UNGCPRO; |
| 1035 | return 0; | 1037 | return -2; |
| 1036 | } | 1038 | } |
| 1037 | } | 1039 | } |
| 1038 | else | 1040 | else |