aboutsummaryrefslogtreecommitdiffstats
path: root/src/lread.c
diff options
context:
space:
mode:
authorMiles Bader2006-06-07 18:05:10 +0000
committerMiles Bader2006-06-07 18:05:10 +0000
commitb883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb (patch)
treede3804210a8cd955e0d3b9abc15679480930bc82 /src/lread.c
parent885b7d0991bd4b4b8f4bd1d3cd21c18a697bbce2 (diff)
parent26c9afc3239e18b03537faaea33e3e82e28099e6 (diff)
downloademacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.tar.gz
emacs-b883cdb2fefa8ea9c3b0d82eba7a9ee792f871bb.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 285-296) - Update from CVS - Merge from gnus--rel--5.10 - Update from CVS: admin/FOR-RELEASE: Update refcard section. * gnus--rel--5.10 (patch 102-104) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-64
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c73
1 files changed, 49 insertions, 24 deletions
diff --git a/src/lread.c b/src/lread.c
index b6161ebedaa..d8abde1c458 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -89,6 +89,7 @@ Lisp_Object Qascii_character, Qload, Qload_file_name;
89Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; 89Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction;
90Lisp_Object Qinhibit_file_name_operation; 90Lisp_Object Qinhibit_file_name_operation;
91Lisp_Object Qeval_buffer_list, Veval_buffer_list; 91Lisp_Object Qeval_buffer_list, Veval_buffer_list;
92Lisp_Object Qfile_truename, Qdo_after_load_evaluation; /* ACM 2006/5/16 */
92 93
93/* Used instead of Qget_file_char while loading *.elc files compiled 94/* Used instead of Qget_file_char while loading *.elc files compiled
94 by Emacs 21 or older. */ 95 by Emacs 21 or older. */
@@ -897,8 +898,8 @@ Return t if the file exists and loads successfully. */)
897 register int fd = -1; 898 register int fd = -1;
898 int count = SPECPDL_INDEX (); 899 int count = SPECPDL_INDEX ();
899 Lisp_Object temp; 900 Lisp_Object temp;
900 struct gcpro gcpro1, gcpro2; 901 struct gcpro gcpro1, gcpro2, gcpro3;
901 Lisp_Object found, efound; 902 Lisp_Object found, efound, hist_file_name;
902 /* 1 means we printed the ".el is newer" message. */ 903 /* 1 means we printed the ".el is newer" message. */
903 int newer = 0; 904 int newer = 0;
904 /* 1 means we are loading a compiled file. */ 905 /* 1 means we are loading a compiled file. */
@@ -906,6 +907,7 @@ Return t if the file exists and loads successfully. */)
906 Lisp_Object handler; 907 Lisp_Object handler;
907 int safe_p = 1; 908 int safe_p = 1;
908 char *fmode = "r"; 909 char *fmode = "r";
910 Lisp_Object tmp[2];
909 int version; 911 int version;
910 912
911#ifdef DOS_NT 913#ifdef DOS_NT
@@ -924,7 +926,7 @@ Return t if the file exists and loads successfully. */)
924 the need to gcpro noerror, nomessage and nosuffix. 926 the need to gcpro noerror, nomessage and nosuffix.
925 (Below here, we care only whether they are nil or not.) 927 (Below here, we care only whether they are nil or not.)
926 The presence of this call is the result of a historical accident: 928 The presence of this call is the result of a historical accident:
927 it used to be in every file-operations and when it got removed 929 it used to be in every file-operation and when it got removed
928 everywhere, it accidentally stayed here. Since then, enough people 930 everywhere, it accidentally stayed here. Since then, enough people
929 supposedly have things like (load "$PROJECT/foo.el") in their .emacs 931 supposedly have things like (load "$PROJECT/foo.el") in their .emacs
930 that it seemed risky to remove. */ 932 that it seemed risky to remove. */
@@ -944,7 +946,6 @@ Return t if the file exists and loads successfully. */)
944 if (SCHARS (file) > 0) 946 if (SCHARS (file) > 0)
945 { 947 {
946 int size = SBYTES (file); 948 int size = SBYTES (file);
947 Lisp_Object tmp[2];
948 949
949 found = Qnil; 950 found = Qnil;
950 GCPRO2 (file, found); 951 GCPRO2 (file, found);
@@ -1028,6 +1029,13 @@ Return t if the file exists and loads successfully. */)
1028 Vloads_in_progress = Fcons (found, Vloads_in_progress); 1029 Vloads_in_progress = Fcons (found, Vloads_in_progress);
1029 } 1030 }
1030 1031
1032 /* Get the name for load-history. */
1033 hist_file_name = (! NILP (Vpurify_flag)
1034 ? Fconcat (2, (tmp[0] = Ffile_name_directory (file),
1035 tmp[1] = Ffile_name_nondirectory (found),
1036 tmp))
1037 : found) ;
1038
1031 version = -1; 1039 version = -1;
1032 if (!bcmp (SDATA (found) + SBYTES (found) - 4, 1040 if (!bcmp (SDATA (found) + SBYTES (found) - 4,
1033 ".elc", 4) 1041 ".elc", 4)
@@ -1040,7 +1048,7 @@ Return t if the file exists and loads successfully. */)
1040 struct stat s1, s2; 1048 struct stat s1, s2;
1041 int result; 1049 int result;
1042 1050
1043 GCPRO2 (file, found); 1051 GCPRO3 (file, found, hist_file_name);
1044 1052
1045 if (version < 0 1053 if (version < 0
1046 && ! (version = safe_to_load_p (fd))) 1054 && ! (version = safe_to_load_p (fd)))
@@ -1095,14 +1103,14 @@ Return t if the file exists and loads successfully. */)
1095 1103
1096 if (fd >= 0) 1104 if (fd >= 0)
1097 emacs_close (fd); 1105 emacs_close (fd);
1098 val = call4 (Vload_source_file_function, found, file, 1106 val = call4 (Vload_source_file_function, found, hist_file_name,
1099 NILP (noerror) ? Qnil : Qt, 1107 NILP (noerror) ? Qnil : Qt,
1100 NILP (nomessage) ? Qnil : Qt); 1108 NILP (nomessage) ? Qnil : Qt);
1101 return unbind_to (count, val); 1109 return unbind_to (count, val);
1102 } 1110 }
1103 } 1111 }
1104 1112
1105 GCPRO2 (file, found); 1113 GCPRO3 (file, found, hist_file_name);
1106 1114
1107#ifdef WINDOWSNT 1115#ifdef WINDOWSNT
1108 emacs_close (fd); 1116 emacs_close (fd);
@@ -1142,23 +1150,23 @@ Return t if the file exists and loads successfully. */)
1142 = Fcons (make_number (fileno (stream)), load_descriptor_list); 1150 = Fcons (make_number (fileno (stream)), load_descriptor_list);
1143 load_in_progress++; 1151 load_in_progress++;
1144 if (! version || version >= 22) 1152 if (! version || version >= 22)
1145 readevalloop (Qget_file_char, stream, 1153 readevalloop (Qget_file_char, stream, hist_file_name,
1146 (! NILP (Vpurify_flag) ? file : found),
1147 Feval, 0, Qnil, Qnil, Qnil, Qnil); 1154 Feval, 0, Qnil, Qnil, Qnil, Qnil);
1148 else 1155 else
1149 { 1156 {
1150 /* We can't handle a file which was compiled with 1157 /* We can't handle a file which was compiled with
1151 byte-compile-dynamic by older version of Emacs. */ 1158 byte-compile-dynamic by older version of Emacs. */
1152 specbind (Qload_force_doc_strings, Qt); 1159 specbind (Qload_force_doc_strings, Qt);
1153 readevalloop (Qget_emacs_mule_file_char, stream, file, Feval, 1160 readevalloop (Qget_emacs_mule_file_char, stream, hist_file_name, Feval,
1154 0, Qnil, Qnil, Qnil, Qnil); 1161 0, Qnil, Qnil, Qnil, Qnil);
1155 } 1162 }
1156 unbind_to (count, Qnil); 1163 unbind_to (count, Qnil);
1157 1164
1158 /* Run any load-hooks for this file. */ 1165 /* Run any eval-after-load forms for this file */
1159 temp = Fassoc (file, Vafter_load_alist); 1166 if (NILP (Vpurify_flag)
1160 if (!NILP (temp)) 1167 && (!NILP (Ffboundp (Qdo_after_load_evaluation))))
1161 Fprogn (Fcdr (temp)); 1168 call1 (Qdo_after_load_evaluation, hist_file_name) ;
1169
1162 UNGCPRO; 1170 UNGCPRO;
1163 1171
1164 if (saved_doc_string) 1172 if (saved_doc_string)
@@ -1583,6 +1591,12 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1583 1591
1584 GCPRO4 (sourcename, readfun, start, end); 1592 GCPRO4 (sourcename, readfun, start, end);
1585 1593
1594 /* Try to ensure sourcename is a truename, except whilst preloading. */
1595 if (NILP (Vpurify_flag)
1596 && !NILP (sourcename) && Ffile_name_absolute_p (sourcename)
1597 && (!NILP (Ffboundp (Qfile_truename))))
1598 sourcename = call1 (Qfile_truename, sourcename) ;
1599
1586 LOADHIST_ATTACH (sourcename); 1600 LOADHIST_ATTACH (sourcename);
1587 1601
1588 continue_reading_p = 1; 1602 continue_reading_p = 1;
@@ -4110,16 +4124,17 @@ customize `jka-compr-load-suffixes' rather than the present variable. */);
4110 4124
4111 DEFVAR_LISP ("after-load-alist", &Vafter_load_alist, 4125 DEFVAR_LISP ("after-load-alist", &Vafter_load_alist,
4112 doc: /* An alist of expressions to be evalled when particular files are loaded. 4126 doc: /* An alist of expressions to be evalled when particular files are loaded.
4113Each element looks like (FILENAME FORMS...). 4127Each element looks like (REGEXP-OR-FEATURE FORMS...).
4114When `load' is run and the file-name argument is FILENAME, 4128
4115the FORMS in the corresponding element are executed at the end of loading. 4129REGEXP-OR-FEATURE is either a regular expression to match file names, or
4116 4130a symbol \(a feature name).
4117FILENAME must match exactly! Normally FILENAME is the name of a library, 4131
4118with no directory specified, since that is how `load' is normally called. 4132When `load' is run and the file-name argument matches an element's
4119An error in FORMS does not undo the load, 4133REGEXP-OR-FEATURE, or when `provide' is run and provides the symbol
4120but does prevent execution of the rest of the FORMS. 4134REGEXP-OR-FEATURE, the FORMS in the element are executed.
4121FILENAME can also be a symbol (a feature) and FORMS are then executed 4135
4122when the corresponding call to `provide' is made. */); 4136An error in FORMS does not undo the load, but does prevent execution of
4137the rest of the FORMS. */);
4123 Vafter_load_alist = Qnil; 4138 Vafter_load_alist = Qnil;
4124 4139
4125 DEFVAR_LISP ("load-history", &Vload_history, 4140 DEFVAR_LISP ("load-history", &Vload_history,
@@ -4127,6 +4142,10 @@ when the corresponding call to `provide' is made. */);
4127Each alist element is a list that starts with a file name, 4142Each alist element is a list that starts with a file name,
4128except for one element (optional) that starts with nil and describes 4143except for one element (optional) that starts with nil and describes
4129definitions evaluated from buffers not visiting files. 4144definitions evaluated from buffers not visiting files.
4145
4146The file name is absolute and is the true file name (i.e. it doesn't
4147contain symbolic links) of the loaded file.
4148
4130The remaining elements of each list are symbols defined as variables 4149The remaining elements of each list are symbols defined as variables
4131and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)', 4150and cons cells of the form `(provide . FEATURE)', `(require . FEATURE)',
4132`(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'. 4151`(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'.
@@ -4263,6 +4282,12 @@ to load. See also `load-dangerous-libraries'. */);
4263 Qeval_buffer_list = intern ("eval-buffer-list"); 4282 Qeval_buffer_list = intern ("eval-buffer-list");
4264 staticpro (&Qeval_buffer_list); 4283 staticpro (&Qeval_buffer_list);
4265 4284
4285 Qfile_truename = intern ("file-truename");
4286 staticpro (&Qfile_truename) ;
4287
4288 Qdo_after_load_evaluation = intern ("do-after-load-evaluation");
4289 staticpro (&Qdo_after_load_evaluation) ;
4290
4266 staticpro (&dump_path); 4291 staticpro (&dump_path);
4267 4292
4268 staticpro (&read_objects); 4293 staticpro (&read_objects);