aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-05-25 12:27:58 -0700
committerPaul Eggert2012-05-25 12:27:58 -0700
commit23d10a2703c40fc6676a74a249f266942627225e (patch)
tree8a1fb6da04ca2482b392201c2496c153fde6c5df /src
parent243e053005d21aa66c2fc0d5be299d677de02fa5 (diff)
parentc6574eb515ff0d49b5781cc85e3655e82f787db8 (diff)
downloademacs-23d10a2703c40fc6676a74a249f266942627225e.tar.gz
emacs-23d10a2703c40fc6676a74a249f266942627225e.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/lisp.mk36
-rw-r--r--src/lread.c141
3 files changed, 86 insertions, 102 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index aa8f5c3a150..611e095daa9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -799,8 +799,19 @@
799 rather than rolling our own approximation. 799 rather than rolling our own approximation.
800 (SCROLL_BAR_VEC_SIZE): Remove; not used. 800 (SCROLL_BAR_VEC_SIZE): Remove; not used.
801 801
8022012-05-25 Glenn Morris <rgm@gnu.org>
803
804 * lisp.mk (lisp): Update for more files being compiled now.
805
8022012-05-25 Stefan Monnier <monnier@iro.umontreal.ca> 8062012-05-25 Stefan Monnier <monnier@iro.umontreal.ca>
803 807
808 * lread.c: Remove `read_pure' which makes no difference.
809 (read_pure): Remove var.
810 (unreadpure): Remove function.
811 (readevalloop): Don't call read_list with -1 flag.
812 (read1, read_vector): Don't test read_pure any more.
813 (read_list): Simplify.
814
804 * fileio.c, character.h: Minor style tweaks. 815 * fileio.c, character.h: Minor style tweaks.
805 816
8062012-05-24 Dmitry Antipov <dmantipov@yandex.ru> 8172012-05-24 Dmitry Antipov <dmantipov@yandex.ru>
diff --git a/src/lisp.mk b/src/lisp.mk
index 4608cc3f687..bd0ec223787 100644
--- a/src/lisp.mk
+++ b/src/lisp.mk
@@ -53,7 +53,7 @@ lisp = \
53 $(lispsource)/emacs-lisp/byte-run.elc \ 53 $(lispsource)/emacs-lisp/byte-run.elc \
54 $(lispsource)/emacs-lisp/backquote.elc \ 54 $(lispsource)/emacs-lisp/backquote.elc \
55 $(lispsource)/subr.elc \ 55 $(lispsource)/subr.elc \
56 $(lispsource)/version.el \ 56 $(lispsource)/version.elc \
57 $(lispsource)/widget.elc \ 57 $(lispsource)/widget.elc \
58 $(lispsource)/custom.elc \ 58 $(lispsource)/custom.elc \
59 $(lispsource)/emacs-lisp/map-ynp.elc \ 59 $(lispsource)/emacs-lisp/map-ynp.elc \
@@ -82,28 +82,28 @@ lisp = \
82 $(lispsource)/language/chinese.elc \ 82 $(lispsource)/language/chinese.elc \
83 $(lispsource)/language/cyrillic.elc \ 83 $(lispsource)/language/cyrillic.elc \
84 $(lispsource)/language/indian.elc \ 84 $(lispsource)/language/indian.elc \
85 $(lispsource)/language/sinhala.el \ 85 $(lispsource)/language/sinhala.elc \
86 $(lispsource)/language/english.el \ 86 $(lispsource)/language/english.elc \
87 $(lispsource)/language/ethiopic.elc \ 87 $(lispsource)/language/ethiopic.elc \
88 $(lispsource)/language/european.elc \ 88 $(lispsource)/language/european.elc \
89 $(lispsource)/language/czech.el \ 89 $(lispsource)/language/czech.elc \
90 $(lispsource)/language/slovak.el \ 90 $(lispsource)/language/slovak.elc \
91 $(lispsource)/language/romanian.el \ 91 $(lispsource)/language/romanian.elc \
92 $(lispsource)/language/greek.el \ 92 $(lispsource)/language/greek.elc \
93 $(lispsource)/language/hebrew.elc \ 93 $(lispsource)/language/hebrew.elc \
94 $(lispsource)/language/japanese.el \ 94 $(lispsource)/language/japanese.elc \
95 $(lispsource)/language/korean.el \ 95 $(lispsource)/language/korean.elc \
96 $(lispsource)/language/lao.el \ 96 $(lispsource)/language/lao.elc \
97 $(lispsource)/language/tai-viet.el \ 97 $(lispsource)/language/tai-viet.elc \
98 $(lispsource)/language/thai.el \ 98 $(lispsource)/language/thai.elc \
99 $(lispsource)/language/tibetan.elc \ 99 $(lispsource)/language/tibetan.elc \
100 $(lispsource)/language/vietnamese.elc \ 100 $(lispsource)/language/vietnamese.elc \
101 $(lispsource)/language/misc-lang.el \ 101 $(lispsource)/language/misc-lang.elc \
102 $(lispsource)/language/utf-8-lang.el \ 102 $(lispsource)/language/utf-8-lang.elc \
103 $(lispsource)/language/georgian.el \ 103 $(lispsource)/language/georgian.elc \
104 $(lispsource)/language/khmer.el \ 104 $(lispsource)/language/khmer.elc \
105 $(lispsource)/language/burmese.el \ 105 $(lispsource)/language/burmese.elc \
106 $(lispsource)/language/cham.el \ 106 $(lispsource)/language/cham.elc \
107 $(lispsource)/indent.elc \ 107 $(lispsource)/indent.elc \
108 $(lispsource)/window.elc \ 108 $(lispsource)/window.elc \
109 $(lispsource)/frame.elc \ 109 $(lispsource)/frame.elc \
diff --git a/src/lread.c b/src/lread.c
index a7ceec3bb4a..80250cfcb1c 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -61,7 +61,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
61#define file_tell ftell 61#define file_tell ftell
62#endif 62#endif
63 63
64/* hash table read constants */ 64/* Hash table read constants. */
65static Lisp_Object Qhash_table, Qdata; 65static Lisp_Object Qhash_table, Qdata;
66static Lisp_Object Qtest, Qsize; 66static Lisp_Object Qtest, Qsize;
67static Lisp_Object Qweakness; 67static Lisp_Object Qweakness;
@@ -105,16 +105,13 @@ static Lisp_Object load_descriptor_list;
105/* File for get_file_char to read from. Use by load. */ 105/* File for get_file_char to read from. Use by load. */
106static FILE *instream; 106static FILE *instream;
107 107
108/* When nonzero, read conses in pure space */
109static int read_pure;
110
111/* For use within read-from-string (this reader is non-reentrant!!) */ 108/* For use within read-from-string (this reader is non-reentrant!!) */
112static ptrdiff_t read_from_string_index; 109static ptrdiff_t read_from_string_index;
113static ptrdiff_t read_from_string_index_byte; 110static ptrdiff_t read_from_string_index_byte;
114static ptrdiff_t read_from_string_limit; 111static ptrdiff_t read_from_string_limit;
115 112
116/* Number of characters read in the current call to Fread or 113/* Number of characters read in the current call to Fread or
117 Fread_from_string. */ 114 Fread_from_string. */
118static EMACS_INT readchar_count; 115static EMACS_INT readchar_count;
119 116
120/* This contains the last string skipped with #@. */ 117/* This contains the last string skipped with #@. */
@@ -187,7 +184,7 @@ static int readbyte_from_string (int, Lisp_Object);
187/* When READCHARFUN is Qget_file_char, Qget_emacs_mule_file_char, 184/* When READCHARFUN is Qget_file_char, Qget_emacs_mule_file_char,
188 Qlambda, or a cons, we use this to keep an unread character because 185 Qlambda, or a cons, we use this to keep an unread character because
189 a file stream can't handle multibyte-char unreading. The value -1 186 a file stream can't handle multibyte-char unreading. The value -1
190 means that there's no unread character. */ 187 means that there's no unread character. */
191static int unread_char; 188static int unread_char;
192 189
193static int 190static int
@@ -447,7 +444,7 @@ readbyte_from_file (int c, Lisp_Object readcharfun)
447 c = getc (instream); 444 c = getc (instream);
448 445
449#ifdef EINTR 446#ifdef EINTR
450 /* Interrupted reads have been observed while reading over the network */ 447 /* Interrupted reads have been observed while reading over the network. */
451 while (c == EOF && ferror (instream) && errno == EINTR) 448 while (c == EOF && ferror (instream) && errno == EINTR)
452 { 449 {
453 UNBLOCK_INPUT; 450 UNBLOCK_INPUT;
@@ -1070,7 +1067,7 @@ Return t if the file exists and loads successfully. */)
1070 1067
1071 1068
1072 /* Avoid weird lossage with null string as arg, 1069 /* Avoid weird lossage with null string as arg,
1073 since it would try to load a directory as a Lisp file */ 1070 since it would try to load a directory as a Lisp file. */
1074 if (SBYTES (file) > 0) 1071 if (SBYTES (file) > 0)
1075 { 1072 {
1076 ptrdiff_t size = SBYTES (file); 1073 ptrdiff_t size = SBYTES (file);
@@ -1174,7 +1171,7 @@ Return t if the file exists and loads successfully. */)
1174 Vload_source_file_function. */ 1171 Vload_source_file_function. */
1175 specbind (Qlexical_binding, Qnil); 1172 specbind (Qlexical_binding, Qnil);
1176 1173
1177 /* Get the name for load-history. */ 1174 /* Get the name for load-history. */
1178 hist_file_name = (! NILP (Vpurify_flag) 1175 hist_file_name = (! NILP (Vpurify_flag)
1179 ? Fconcat (2, (tmp[0] = Ffile_name_directory (file), 1176 ? Fconcat (2, (tmp[0] = Ffile_name_directory (file),
1180 tmp[1] = Ffile_name_nondirectory (found), 1177 tmp[1] = Ffile_name_nondirectory (found),
@@ -1327,7 +1324,7 @@ Return t if the file exists and loads successfully. */)
1327 } 1324 }
1328 unbind_to (count, Qnil); 1325 unbind_to (count, Qnil);
1329 1326
1330 /* Run any eval-after-load forms for this file */ 1327 /* Run any eval-after-load forms for this file. */
1331 if (!NILP (Ffboundp (Qdo_after_load_evaluation))) 1328 if (!NILP (Ffboundp (Qdo_after_load_evaluation)))
1332 call1 (Qdo_after_load_evaluation, hist_file_name) ; 1329 call1 (Qdo_after_load_evaluation, hist_file_name) ;
1333 1330
@@ -1359,7 +1356,7 @@ Return t if the file exists and loads successfully. */)
1359} 1356}
1360 1357
1361static Lisp_Object 1358static Lisp_Object
1362load_unwind (Lisp_Object arg) /* used as unwind-protect function in load */ 1359load_unwind (Lisp_Object arg) /* Used as unwind-protect function in load. */
1363{ 1360{
1364 FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; 1361 FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer;
1365 if (stream != NULL) 1362 if (stream != NULL)
@@ -1478,13 +1475,13 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
1478 { 1475 {
1479 filename = Fexpand_file_name (str, XCAR (path)); 1476 filename = Fexpand_file_name (str, XCAR (path));
1480 if (!complete_filename_p (filename)) 1477 if (!complete_filename_p (filename))
1481 /* If there are non-absolute elts in PATH (eg ".") */ 1478 /* If there are non-absolute elts in PATH (eg "."). */
1482 /* Of course, this could conceivably lose if luser sets 1479 /* Of course, this could conceivably lose if luser sets
1483 default-directory to be something non-absolute... */ 1480 default-directory to be something non-absolute... */
1484 { 1481 {
1485 filename = Fexpand_file_name (filename, BVAR (current_buffer, directory)); 1482 filename = Fexpand_file_name (filename, BVAR (current_buffer, directory));
1486 if (!complete_filename_p (filename)) 1483 if (!complete_filename_p (filename))
1487 /* Give up on this path element! */ 1484 /* Give up on this path element! */
1488 continue; 1485 continue;
1489 } 1486 }
1490 1487
@@ -1611,12 +1608,12 @@ build_load_history (Lisp_Object filename, int entire)
1611 { 1608 {
1612 tem = XCAR (tail); 1609 tem = XCAR (tail);
1613 1610
1614 /* Find the feature's previous assoc list... */ 1611 /* Find the feature's previous assoc list... */
1615 if (!NILP (Fequal (filename, Fcar (tem)))) 1612 if (!NILP (Fequal (filename, Fcar (tem))))
1616 { 1613 {
1617 foundit = 1; 1614 foundit = 1;
1618 1615
1619 /* If we're loading the entire file, remove old data. */ 1616 /* If we're loading the entire file, remove old data. */
1620 if (entire) 1617 if (entire)
1621 { 1618 {
1622 if (NILP (prev)) 1619 if (NILP (prev))
@@ -1658,13 +1655,6 @@ build_load_history (Lisp_Object filename, int entire)
1658} 1655}
1659 1656
1660static Lisp_Object 1657static Lisp_Object
1661unreadpure (Lisp_Object junk) /* Used as unwind-protect function in readevalloop */
1662{
1663 read_pure = 0;
1664 return Qnil;
1665}
1666
1667static Lisp_Object
1668readevalloop_1 (Lisp_Object old) 1658readevalloop_1 (Lisp_Object old)
1669{ 1659{
1670 load_convert_to_unibyte = ! NILP (old); 1660 load_convert_to_unibyte = ! NILP (old);
@@ -1740,7 +1730,7 @@ readevalloop (Lisp_Object readcharfun,
1740 1730
1741 GCPRO4 (sourcename, readfun, start, end); 1731 GCPRO4 (sourcename, readfun, start, end);
1742 1732
1743 /* Try to ensure sourcename is a truename, except whilst preloading. */ 1733 /* Try to ensure sourcename is a truename, except whilst preloading. */
1744 if (NILP (Vpurify_flag) 1734 if (NILP (Vpurify_flag)
1745 && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename)) 1735 && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename))
1746 && !NILP (Ffboundp (Qfile_truename))) 1736 && !NILP (Ffboundp (Qfile_truename)))
@@ -1805,8 +1795,7 @@ readevalloop (Lisp_Object readcharfun,
1805 1795
1806 if (!NILP (Vpurify_flag) && c == '(') 1796 if (!NILP (Vpurify_flag) && c == '(')
1807 { 1797 {
1808 record_unwind_protect (unreadpure, Qnil); 1798 val = read_list (0, readcharfun);
1809 val = read_list (-1, readcharfun);
1810 } 1799 }
1811 else 1800 else
1812 { 1801 {
@@ -1934,7 +1923,7 @@ This function does not move point. */)
1934 specbind (Qstandard_output, tem); 1923 specbind (Qstandard_output, tem);
1935 specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); 1924 specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list));
1936 1925
1937 /* readevalloop calls functions which check the type of start and end. */ 1926 /* `readevalloop' calls functions which check the type of start and end. */
1938 readevalloop (cbuf, 0, BVAR (XBUFFER (cbuf), filename), 1927 readevalloop (cbuf, 0, BVAR (XBUFFER (cbuf), filename),
1939 !NILP (printflag), Qnil, read_function, 1928 !NILP (printflag), Qnil, read_function,
1940 start, end); 1929 start, end);
@@ -1977,16 +1966,16 @@ START and END optionally delimit a substring of STRING from which to read;
1977{ 1966{
1978 Lisp_Object ret; 1967 Lisp_Object ret;
1979 CHECK_STRING (string); 1968 CHECK_STRING (string);
1980 /* read_internal_start sets read_from_string_index. */ 1969 /* `read_internal_start' sets `read_from_string_index'. */
1981 ret = read_internal_start (string, start, end); 1970 ret = read_internal_start (string, start, end);
1982 return Fcons (ret, make_number (read_from_string_index)); 1971 return Fcons (ret, make_number (read_from_string_index));
1983} 1972}
1984 1973
1985/* Function to set up the global context we need in toplevel read 1974/* Function to set up the global context we need in toplevel read
1986 calls. */ 1975 calls. */
1987static Lisp_Object 1976static Lisp_Object
1988read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) 1977read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end)
1989/* start, end only used when stream is a string. */ 1978/* `start', `end' only used when stream is a string. */
1990{ 1979{
1991 Lisp_Object retval; 1980 Lisp_Object retval;
1992 1981
@@ -2051,7 +2040,7 @@ invalid_syntax (const char *s)
2051 2040
2052 2041
2053/* Use this for recursive reads, in contexts where internal tokens 2042/* Use this for recursive reads, in contexts where internal tokens
2054 are not allowed. */ 2043 are not allowed. */
2055 2044
2056static Lisp_Object 2045static Lisp_Object
2057read0 (Lisp_Object readcharfun) 2046read0 (Lisp_Object readcharfun)
@@ -2078,7 +2067,7 @@ read_escape (Lisp_Object readcharfun, int stringp)
2078{ 2067{
2079 register int c = READCHAR; 2068 register int c = READCHAR;
2080 /* \u allows up to four hex digits, \U up to eight. Default to the 2069 /* \u allows up to four hex digits, \U up to eight. Default to the
2081 behavior for \u, and change this value in the case that \U is seen. */ 2070 behavior for \u, and change this value in the case that \U is seen. */
2082 int unicode_hex_count = 4; 2071 int unicode_hex_count = 4;
2083 2072
2084 switch (c) 2073 switch (c)
@@ -2264,8 +2253,8 @@ read_escape (Lisp_Object readcharfun, int stringp)
2264 while (++count <= unicode_hex_count) 2253 while (++count <= unicode_hex_count)
2265 { 2254 {
2266 c = READCHAR; 2255 c = READCHAR;
2267 /* isdigit and isalpha may be locale-specific, which we don't 2256 /* `isdigit' and `isalpha' may be locale-specific, which we don't
2268 want. */ 2257 want. */
2269 if (c >= '0' && c <= '9') i = (i << 4) + (c - '0'); 2258 if (c >= '0' && c <= '9') i = (i << 4) + (c - '0');
2270 else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10; 2259 else if (c >= 'a' && c <= 'f') i = (i << 4) + (c - 'a') + 10;
2271 else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10; 2260 else if (c >= 'A' && c <= 'F') i = (i << 4) + (c - 'A') + 10;
@@ -2419,13 +2408,13 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2419 { 2408 {
2420 /* Accept extended format for hashtables (extensible to 2409 /* Accept extended format for hashtables (extensible to
2421 other types), e.g. 2410 other types), e.g.
2422 #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */ 2411 #s(hash-table size 2 test equal data (k1 v1 k2 v2)) */
2423 Lisp_Object tmp = read_list (0, readcharfun); 2412 Lisp_Object tmp = read_list (0, readcharfun);
2424 Lisp_Object head = CAR_SAFE (tmp); 2413 Lisp_Object head = CAR_SAFE (tmp);
2425 Lisp_Object data = Qnil; 2414 Lisp_Object data = Qnil;
2426 Lisp_Object val = Qnil; 2415 Lisp_Object val = Qnil;
2427 /* The size is 2 * number of allowed keywords to 2416 /* The size is 2 * number of allowed keywords to
2428 make-hash-table. */ 2417 make-hash-table. */
2429 Lisp_Object params[10]; 2418 Lisp_Object params[10];
2430 Lisp_Object ht; 2419 Lisp_Object ht;
2431 Lisp_Object key = Qnil; 2420 Lisp_Object key = Qnil;
@@ -2437,36 +2426,36 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2437 2426
2438 tmp = CDR_SAFE (tmp); 2427 tmp = CDR_SAFE (tmp);
2439 2428
2440 /* This is repetitive but fast and simple. */ 2429 /* This is repetitive but fast and simple. */
2441 params[param_count] = QCsize; 2430 params[param_count] = QCsize;
2442 params[param_count+1] = Fplist_get (tmp, Qsize); 2431 params[param_count + 1] = Fplist_get (tmp, Qsize);
2443 if (!NILP (params[param_count + 1])) 2432 if (!NILP (params[param_count + 1]))
2444 param_count += 2; 2433 param_count += 2;
2445 2434
2446 params[param_count] = QCtest; 2435 params[param_count] = QCtest;
2447 params[param_count+1] = Fplist_get (tmp, Qtest); 2436 params[param_count + 1] = Fplist_get (tmp, Qtest);
2448 if (!NILP (params[param_count + 1])) 2437 if (!NILP (params[param_count + 1]))
2449 param_count += 2; 2438 param_count += 2;
2450 2439
2451 params[param_count] = QCweakness; 2440 params[param_count] = QCweakness;
2452 params[param_count+1] = Fplist_get (tmp, Qweakness); 2441 params[param_count + 1] = Fplist_get (tmp, Qweakness);
2453 if (!NILP (params[param_count + 1])) 2442 if (!NILP (params[param_count + 1]))
2454 param_count += 2; 2443 param_count += 2;
2455 2444
2456 params[param_count] = QCrehash_size; 2445 params[param_count] = QCrehash_size;
2457 params[param_count+1] = Fplist_get (tmp, Qrehash_size); 2446 params[param_count + 1] = Fplist_get (tmp, Qrehash_size);
2458 if (!NILP (params[param_count + 1])) 2447 if (!NILP (params[param_count + 1]))
2459 param_count += 2; 2448 param_count += 2;
2460 2449
2461 params[param_count] = QCrehash_threshold; 2450 params[param_count] = QCrehash_threshold;
2462 params[param_count+1] = Fplist_get (tmp, Qrehash_threshold); 2451 params[param_count + 1] = Fplist_get (tmp, Qrehash_threshold);
2463 if (!NILP (params[param_count + 1])) 2452 if (!NILP (params[param_count + 1]))
2464 param_count += 2; 2453 param_count += 2;
2465 2454
2466 /* This is the hashtable data. */ 2455 /* This is the hashtable data. */
2467 data = Fplist_get (tmp, Qdata); 2456 data = Fplist_get (tmp, Qdata);
2468 2457
2469 /* Now use params to make a new hashtable and fill it. */ 2458 /* Now use params to make a new hashtable and fill it. */
2470 ht = Fmake_hash_table (param_count, params); 2459 ht = Fmake_hash_table (param_count, params);
2471 2460
2472 while (CONSP (data)) 2461 while (CONSP (data))
@@ -2734,7 +2723,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2734 n for #n#. */ 2723 n for #n#. */
2735 if (c == '=') 2724 if (c == '=')
2736 { 2725 {
2737 /* Make a placeholder for #n# to use temporarily */ 2726 /* Make a placeholder for #n# to use temporarily. */
2738 Lisp_Object placeholder; 2727 Lisp_Object placeholder;
2739 Lisp_Object cell; 2728 Lisp_Object cell;
2740 2729
@@ -2742,10 +2731,10 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2742 cell = Fcons (make_number (n), placeholder); 2731 cell = Fcons (make_number (n), placeholder);
2743 read_objects = Fcons (cell, read_objects); 2732 read_objects = Fcons (cell, read_objects);
2744 2733
2745 /* Read the object itself. */ 2734 /* Read the object itself. */
2746 tem = read0 (readcharfun); 2735 tem = read0 (readcharfun);
2747 2736
2748 /* Now put it everywhere the placeholder was... */ 2737 /* Now put it everywhere the placeholder was... */
2749 substitute_object_in_subtree (tem, placeholder); 2738 substitute_object_in_subtree (tem, placeholder);
2750 2739
2751 /* ...and #n# will use the real value from now on. */ 2740 /* ...and #n# will use the real value from now on. */
@@ -2928,7 +2917,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2928 2917
2929 ch = read_escape (readcharfun, 1); 2918 ch = read_escape (readcharfun, 1);
2930 2919
2931 /* CH is -1 if \ newline has just been seen */ 2920 /* CH is -1 if \ newline has just been seen. */
2932 if (ch == -1) 2921 if (ch == -1)
2933 { 2922 {
2934 if (p == read_buffer) 2923 if (p == read_buffer)
@@ -2943,7 +2932,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2943 force_singlebyte = 1; 2932 force_singlebyte = 1;
2944 else if (! ASCII_CHAR_P (ch)) 2933 else if (! ASCII_CHAR_P (ch))
2945 force_multibyte = 1; 2934 force_multibyte = 1;
2946 else /* i.e. ASCII_CHAR_P (ch) */ 2935 else /* I.e. ASCII_CHAR_P (ch). */
2947 { 2936 {
2948 /* Allow `\C- ' and `\C-?'. */ 2937 /* Allow `\C- ' and `\C-?'. */
2949 if (modifiers == CHAR_CTL) 2938 if (modifiers == CHAR_CTL)
@@ -3011,10 +3000,6 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3011 /* Otherwise, READ_BUFFER contains only ASCII. */ 3000 /* Otherwise, READ_BUFFER contains only ASCII. */
3012 } 3001 }
3013 3002
3014 if (read_pure)
3015 return make_pure_string (read_buffer, nchars, p - read_buffer,
3016 (force_multibyte
3017 || (p - read_buffer != nchars)));
3018 return make_specified_string (read_buffer, nchars, p - read_buffer, 3003 return make_specified_string (read_buffer, nchars, p - read_buffer,
3019 (force_multibyte 3004 (force_multibyte
3020 || (p - read_buffer != nchars))); 3005 || (p - read_buffer != nchars)));
@@ -3134,7 +3119,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3134} 3119}
3135 3120
3136 3121
3137/* List of nodes we've seen during substitute_object_in_subtree. */ 3122/* List of nodes we've seen during substitute_object_in_subtree. */
3138static Lisp_Object seen_list; 3123static Lisp_Object seen_list;
3139 3124
3140static void 3125static void
@@ -3142,23 +3127,23 @@ substitute_object_in_subtree (Lisp_Object object, Lisp_Object placeholder)
3142{ 3127{
3143 Lisp_Object check_object; 3128 Lisp_Object check_object;
3144 3129
3145 /* We haven't seen any objects when we start. */ 3130 /* We haven't seen any objects when we start. */
3146 seen_list = Qnil; 3131 seen_list = Qnil;
3147 3132
3148 /* Make all the substitutions. */ 3133 /* Make all the substitutions. */
3149 check_object 3134 check_object
3150 = substitute_object_recurse (object, placeholder, object); 3135 = substitute_object_recurse (object, placeholder, object);
3151 3136
3152 /* Clear seen_list because we're done with it. */ 3137 /* Clear seen_list because we're done with it. */
3153 seen_list = Qnil; 3138 seen_list = Qnil;
3154 3139
3155 /* The returned object here is expected to always eq the 3140 /* The returned object here is expected to always eq the
3156 original. */ 3141 original. */
3157 if (!EQ (check_object, object)) 3142 if (!EQ (check_object, object))
3158 error ("Unexpected mutation error in reader"); 3143 error ("Unexpected mutation error in reader");
3159} 3144}
3160 3145
3161/* Feval doesn't get called from here, so no gc protection is needed. */ 3146/* Feval doesn't get called from here, so no gc protection is needed. */
3162#define SUBSTITUTE(get_val, set_val) \ 3147#define SUBSTITUTE(get_val, set_val) \
3163 do { \ 3148 do { \
3164 Lisp_Object old_value = get_val; \ 3149 Lisp_Object old_value = get_val; \
@@ -3175,11 +3160,11 @@ substitute_object_in_subtree (Lisp_Object object, Lisp_Object placeholder)
3175static Lisp_Object 3160static Lisp_Object
3176substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Object subtree) 3161substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Object subtree)
3177{ 3162{
3178 /* If we find the placeholder, return the target object. */ 3163 /* If we find the placeholder, return the target object. */
3179 if (EQ (placeholder, subtree)) 3164 if (EQ (placeholder, subtree))
3180 return object; 3165 return object;
3181 3166
3182 /* If we've been to this node before, don't explore it again. */ 3167 /* If we've been to this node before, don't explore it again. */
3183 if (!EQ (Qnil, Fmemq (subtree, seen_list))) 3168 if (!EQ (Qnil, Fmemq (subtree, seen_list)))
3184 return subtree; 3169 return subtree;
3185 3170
@@ -3229,7 +3214,7 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
3229 case Lisp_String: 3214 case Lisp_String:
3230 { 3215 {
3231 /* Check for text properties in each interval. 3216 /* Check for text properties in each interval.
3232 substitute_in_interval contains part of the logic. */ 3217 substitute_in_interval contains part of the logic. */
3233 3218
3234 INTERVAL root_interval = STRING_INTERVALS (subtree); 3219 INTERVAL root_interval = STRING_INTERVALS (subtree);
3235 Lisp_Object arg = Fcons (object, placeholder); 3220 Lisp_Object arg = Fcons (object, placeholder);
@@ -3240,7 +3225,7 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
3240 return subtree; 3225 return subtree;
3241 } 3226 }
3242 3227
3243 /* Other types don't recurse any further. */ 3228 /* Other types don't recurse any further. */
3244 default: 3229 default:
3245 return subtree; 3230 return subtree;
3246 } 3231 }
@@ -3427,7 +3412,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
3427 3412
3428 tem = read_list (1, readcharfun); 3413 tem = read_list (1, readcharfun);
3429 len = Flength (tem); 3414 len = Flength (tem);
3430 vector = (read_pure ? make_pure_vector (XINT (len)) : Fmake_vector (len, Qnil)); 3415 vector = Fmake_vector (len, Qnil);
3431 3416
3432 size = ASIZE (vector); 3417 size = ASIZE (vector);
3433 ptr = XVECTOR (vector)->contents; 3418 ptr = XVECTOR (vector)->contents;
@@ -3474,7 +3459,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
3474 } 3459 }
3475 3460
3476 /* Now handle the bytecode slot. */ 3461 /* Now handle the bytecode slot. */
3477 ptr[COMPILED_BYTECODE] = read_pure ? Fpurecopy (bytestr) : bytestr; 3462 ptr[COMPILED_BYTECODE] = bytestr;
3478 } 3463 }
3479 else if (i == COMPILED_DOC_STRING 3464 else if (i == COMPILED_DOC_STRING
3480 && STRINGP (item) 3465 && STRINGP (item)
@@ -3486,7 +3471,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
3486 item = Fstring_as_multibyte (item); 3471 item = Fstring_as_multibyte (item);
3487 } 3472 }
3488 } 3473 }
3489 ptr[i] = read_pure ? Fpurecopy (item) : item; 3474 ptr[i] = item;
3490 otem = XCONS (tem); 3475 otem = XCONS (tem);
3491 tem = Fcdr (tem); 3476 tem = Fcdr (tem);
3492 free_cons (otem); 3477 free_cons (otem);
@@ -3494,17 +3479,11 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
3494 return vector; 3479 return vector;
3495} 3480}
3496 3481
3497/* FLAG = 1 means check for ] to terminate rather than ) and . 3482/* FLAG = 1 means check for ] to terminate rather than ) and . */
3498 FLAG = -1 means check for starting with defun
3499 and make structure pure. */
3500 3483
3501static Lisp_Object 3484static Lisp_Object
3502read_list (int flag, register Lisp_Object readcharfun) 3485read_list (int flag, register Lisp_Object readcharfun)
3503{ 3486{
3504 /* -1 means check next element for defun,
3505 0 means don't check,
3506 1 means already checked and found defun. */
3507 int defunflag = flag < 0 ? -1 : 0;
3508 Lisp_Object val, tail; 3487 Lisp_Object val, tail;
3509 register Lisp_Object elt, tem; 3488 register Lisp_Object elt, tem;
3510 struct gcpro gcpro1, gcpro2; 3489 struct gcpro gcpro1, gcpro2;
@@ -3666,24 +3645,18 @@ read_list (int flag, register Lisp_Object readcharfun)
3666 } 3645 }
3667 invalid_syntax ("] in a list"); 3646 invalid_syntax ("] in a list");
3668 } 3647 }
3669 tem = (read_pure && flag <= 0 3648 tem = Fcons (elt, Qnil);
3670 ? pure_cons (elt, Qnil)
3671 : Fcons (elt, Qnil));
3672 if (!NILP (tail)) 3649 if (!NILP (tail))
3673 XSETCDR (tail, tem); 3650 XSETCDR (tail, tem);
3674 else 3651 else
3675 val = tem; 3652 val = tem;
3676 tail = tem; 3653 tail = tem;
3677 if (defunflag < 0)
3678 defunflag = EQ (elt, Qdefun);
3679 else if (defunflag > 0)
3680 read_pure = 1;
3681 } 3654 }
3682} 3655}
3683 3656
3684static Lisp_Object initial_obarray; 3657static Lisp_Object initial_obarray;
3685 3658
3686/* oblookup stores the bucket number here, for the sake of Funintern. */ 3659/* `oblookup' stores the bucket number here, for the sake of Funintern. */
3687 3660
3688static size_t oblookup_last_bucket_number; 3661static size_t oblookup_last_bucket_number;
3689 3662
@@ -3915,7 +3888,7 @@ oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff
3915 if (EQ (bucket, make_number (0))) 3888 if (EQ (bucket, make_number (0)))
3916 ; 3889 ;
3917 else if (!SYMBOLP (bucket)) 3890 else if (!SYMBOLP (bucket))
3918 error ("Bad data in guts of obarray"); /* Like CADR error message */ 3891 error ("Bad data in guts of obarray"); /* Like CADR error message. */
3919 else 3892 else
3920 for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next)) 3893 for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next))
3921 { 3894 {
@@ -4022,7 +3995,7 @@ defsubr (struct Lisp_Subr *sname)
4022 XSETSUBR (XSYMBOL (sym)->function, sname); 3995 XSETSUBR (XSYMBOL (sym)->function, sname);
4023} 3996}
4024 3997
4025#ifdef NOTDEF /* use fset in subr.el now */ 3998#ifdef NOTDEF /* Use fset in subr.el now! */
4026void 3999void
4027defalias (struct Lisp_Subr *sname, char *string) 4000defalias (struct Lisp_Subr *sname, char *string)
4028{ 4001{
@@ -4367,7 +4340,7 @@ dir_warning (const char *format, Lisp_Object dirname)
4367{ 4340{
4368 fprintf (stderr, format, SDATA (dirname)); 4341 fprintf (stderr, format, SDATA (dirname));
4369 4342
4370 /* Don't log the warning before we've initialized!! */ 4343 /* Don't log the warning before we've initialized!! */
4371 if (initialized) 4344 if (initialized)
4372 { 4345 {
4373 char *buffer; 4346 char *buffer;