Mercurial > emacs
comparison src/lread.c @ 90261:7beb78bc1f8e
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-97
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 616-696)
- Add lisp/mh-e/.arch-inventory
- Update from CVS
- Merge from gnus--rel--5.10
- Update from CVS: lisp/smerge-mode.el: Add 'tools' to file keywords.
- lisp/gnus/ChangeLog: Remove duplicate entry
* gnus--rel--5.10 (patch 147-181)
- Update from CVS
- Merge from emacs--cvs-trunk--0
- Update from CVS: lisp/mml.el (mml-preview): Doc fix.
- Update from CVS: texi/message.texi: Fix default values.
- Update from CVS: texi/gnus.texi (RSS): Addition.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 16 Jan 2006 08:37:27 +0000 |
parents | 0ca0d9181b5e 28939487a2d5 |
children | 5b7d410e31f9 |
comparison
equal
deleted
inserted
replaced
90260:0ca0d9181b5e | 90261:7beb78bc1f8e |
---|---|
1390 } | 1390 } |
1391 | 1391 |
1392 | 1392 |
1393 /* Merge the list we've accumulated of globals from the current input source | 1393 /* Merge the list we've accumulated of globals from the current input source |
1394 into the load_history variable. The details depend on whether | 1394 into the load_history variable. The details depend on whether |
1395 the source has an associated file name or not. */ | 1395 the source has an associated file name or not. |
1396 | |
1397 FILENAME is the file name that we are loading from. | |
1398 ENTIRE is 1 if loading that entire file, 0 if evaluating part of it. */ | |
1396 | 1399 |
1397 static void | 1400 static void |
1398 build_load_history (stream, source) | 1401 build_load_history (filename, entire) |
1399 FILE *stream; | 1402 Lisp_Object filename; |
1400 Lisp_Object source; | 1403 int entire; |
1401 { | 1404 { |
1402 register Lisp_Object tail, prev, newelt; | 1405 register Lisp_Object tail, prev, newelt; |
1403 register Lisp_Object tem, tem2; | 1406 register Lisp_Object tem, tem2; |
1404 register int foundit, loading; | 1407 register int foundit = 0; |
1405 | |
1406 loading = stream || !NARROWED; | |
1407 | 1408 |
1408 tail = Vload_history; | 1409 tail = Vload_history; |
1409 prev = Qnil; | 1410 prev = Qnil; |
1410 foundit = 0; | 1411 |
1411 while (CONSP (tail)) | 1412 while (CONSP (tail)) |
1412 { | 1413 { |
1413 tem = XCAR (tail); | 1414 tem = XCAR (tail); |
1414 | 1415 |
1415 /* Find the feature's previous assoc list... */ | 1416 /* Find the feature's previous assoc list... */ |
1416 if (!NILP (Fequal (source, Fcar (tem)))) | 1417 if (!NILP (Fequal (filename, Fcar (tem)))) |
1417 { | 1418 { |
1418 foundit = 1; | 1419 foundit = 1; |
1419 | 1420 |
1420 /* If we're loading, remove it. */ | 1421 /* If we're loading the entire file, remove old data. */ |
1421 if (loading) | 1422 if (entire) |
1422 { | 1423 { |
1423 if (NILP (prev)) | 1424 if (NILP (prev)) |
1424 Vload_history = XCDR (tail); | 1425 Vload_history = XCDR (tail); |
1425 else | 1426 else |
1426 Fsetcdr (prev, XCDR (tail)); | 1427 Fsetcdr (prev, XCDR (tail)); |
1448 prev = tail; | 1449 prev = tail; |
1449 tail = XCDR (tail); | 1450 tail = XCDR (tail); |
1450 QUIT; | 1451 QUIT; |
1451 } | 1452 } |
1452 | 1453 |
1453 /* If we're loading, cons the new assoc onto the front of load-history, | 1454 /* If we're loading an entire file, cons the new assoc onto the |
1454 the most-recently-loaded position. Also do this if we didn't find | 1455 front of load-history, the most-recently-loaded position. Also |
1455 an existing member for the current source. */ | 1456 do this if we didn't find an existing member for the file. */ |
1456 if (loading || !foundit) | 1457 if (entire || !foundit) |
1457 Vload_history = Fcons (Fnreverse (Vcurrent_load_list), | 1458 Vload_history = Fcons (Fnreverse (Vcurrent_load_list), |
1458 Vload_history); | 1459 Vload_history); |
1459 } | 1460 } |
1460 | 1461 |
1461 Lisp_Object | 1462 Lisp_Object |
1507 Lisp_Object start, end; | 1508 Lisp_Object start, end; |
1508 { | 1509 { |
1509 register int c; | 1510 register int c; |
1510 register Lisp_Object val; | 1511 register Lisp_Object val; |
1511 int count = SPECPDL_INDEX (); | 1512 int count = SPECPDL_INDEX (); |
1512 struct gcpro gcpro1; | 1513 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
1513 struct buffer *b = 0; | 1514 struct buffer *b = 0; |
1515 int bpos; | |
1514 int continue_reading_p; | 1516 int continue_reading_p; |
1517 /* Nonzero if reading an entire buffer. */ | |
1518 int whole_buffer = 0; | |
1519 /* 1 on the first time around. */ | |
1520 int first_sexp = 1; | |
1521 | |
1522 if (MARKERP (readcharfun)) | |
1523 { | |
1524 if (NILP (start)) | |
1525 start = readcharfun; | |
1526 } | |
1515 | 1527 |
1516 if (BUFFERP (readcharfun)) | 1528 if (BUFFERP (readcharfun)) |
1517 b = XBUFFER (readcharfun); | 1529 b = XBUFFER (readcharfun); |
1518 else if (MARKERP (readcharfun)) | 1530 else if (MARKERP (readcharfun)) |
1519 b = XMARKER (readcharfun)->buffer; | 1531 b = XMARKER (readcharfun)->buffer; |
1520 | 1532 |
1521 specbind (Qstandard_input, readcharfun); | 1533 specbind (Qstandard_input, readcharfun); /* GCPROs readcharfun. */ |
1522 specbind (Qcurrent_load_list, Qnil); | 1534 specbind (Qcurrent_load_list, Qnil); |
1523 record_unwind_protect (readevalloop_1, load_convert_to_unibyte ? Qt : Qnil); | 1535 record_unwind_protect (readevalloop_1, load_convert_to_unibyte ? Qt : Qnil); |
1524 load_convert_to_unibyte = !NILP (unibyte); | 1536 load_convert_to_unibyte = !NILP (unibyte); |
1525 | 1537 |
1526 GCPRO1 (sourcename); | 1538 GCPRO4 (sourcename, readfun, start, end); |
1527 | 1539 |
1528 LOADHIST_ATTACH (sourcename); | 1540 LOADHIST_ATTACH (sourcename); |
1529 | 1541 |
1530 continue_reading_p = 1; | 1542 continue_reading_p = 1; |
1531 while (continue_reading_p) | 1543 while (continue_reading_p) |
1535 if (b != 0 && NILP (b->name)) | 1547 if (b != 0 && NILP (b->name)) |
1536 error ("Reading from killed buffer"); | 1548 error ("Reading from killed buffer"); |
1537 | 1549 |
1538 if (!NILP (start)) | 1550 if (!NILP (start)) |
1539 { | 1551 { |
1552 /* Switch to the buffer we are reading from. */ | |
1540 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 1553 record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
1554 set_buffer_internal (b); | |
1555 | |
1556 /* Save point in it. */ | |
1557 record_unwind_protect (save_excursion_restore, save_excursion_save ()); | |
1558 /* Save ZV in it. */ | |
1541 record_unwind_protect (save_restriction_restore, save_restriction_save ()); | 1559 record_unwind_protect (save_restriction_restore, save_restriction_save ()); |
1560 /* Those get unbound after we read one expression. */ | |
1561 | |
1562 /* Set point and ZV around stuff to be read. */ | |
1542 Fgoto_char (start); | 1563 Fgoto_char (start); |
1543 Fnarrow_to_region (make_number (BEGV), end); | 1564 if (!NILP (end)) |
1544 } | 1565 Fnarrow_to_region (make_number (BEGV), end); |
1566 | |
1567 /* Just for cleanliness, convert END to a marker | |
1568 if it is an integer. */ | |
1569 if (INTEGERP (end)) | |
1570 end = Fpoint_max_marker (); | |
1571 } | |
1572 | |
1573 /* On the first cycle, we can easily test here | |
1574 whether we are reading the whole buffer. */ | |
1575 if (b && first_sexp) | |
1576 whole_buffer = (PT == BEG && ZV == Z); | |
1545 | 1577 |
1546 instream = stream; | 1578 instream = stream; |
1547 read_next: | 1579 read_next: |
1548 c = READCHAR; | 1580 c = READCHAR; |
1549 if (c == ';') | 1581 if (c == ';') |
1590 val = read_internal_start (readcharfun, Qnil, Qnil); | 1622 val = read_internal_start (readcharfun, Qnil, Qnil); |
1591 } | 1623 } |
1592 | 1624 |
1593 if (!NILP (start) && continue_reading_p) | 1625 if (!NILP (start) && continue_reading_p) |
1594 start = Fpoint_marker (); | 1626 start = Fpoint_marker (); |
1627 | |
1628 /* Restore saved point and BEGV. */ | |
1595 unbind_to (count1, Qnil); | 1629 unbind_to (count1, Qnil); |
1596 | 1630 |
1631 /* Now eval what we just read. */ | |
1597 val = (*evalfun) (val); | 1632 val = (*evalfun) (val); |
1598 | 1633 |
1599 if (printflag) | 1634 if (printflag) |
1600 { | 1635 { |
1601 Vvalues = Fcons (val, Vvalues); | 1636 Vvalues = Fcons (val, Vvalues); |
1602 if (EQ (Vstandard_output, Qt)) | 1637 if (EQ (Vstandard_output, Qt)) |
1603 Fprin1 (val, Qnil); | 1638 Fprin1 (val, Qnil); |
1604 else | 1639 else |
1605 Fprint (val, Qnil); | 1640 Fprint (val, Qnil); |
1606 } | 1641 } |
1607 } | 1642 |
1608 | 1643 first_sexp = 0; |
1609 build_load_history (stream, sourcename); | 1644 } |
1645 | |
1646 build_load_history (sourcename, | |
1647 stream || whole_buffer); | |
1648 | |
1610 UNGCPRO; | 1649 UNGCPRO; |
1611 | 1650 |
1612 unbind_to (count, Qnil); | 1651 unbind_to (count, Qnil); |
1613 } | 1652 } |
1614 | 1653 |
1891 if (c == '\\') | 1930 if (c == '\\') |
1892 c = read_escape (readcharfun, 0); | 1931 c = read_escape (readcharfun, 0); |
1893 return c | alt_modifier; | 1932 return c | alt_modifier; |
1894 | 1933 |
1895 case 's': | 1934 case 's': |
1896 if (stringp) | |
1897 return ' '; | |
1898 c = READCHAR; | 1935 c = READCHAR; |
1899 if (c != '-') { | 1936 if (c != '-') |
1900 UNREAD (c); | 1937 { |
1901 return ' '; | 1938 UNREAD (c); |
1902 } | 1939 return ' '; |
1940 } | |
1903 c = READCHAR; | 1941 c = READCHAR; |
1904 if (c == '\\') | 1942 if (c == '\\') |
1905 c = read_escape (readcharfun, 0); | 1943 c = read_escape (readcharfun, 0); |
1906 return c | super_modifier; | 1944 return c | super_modifier; |
1907 | 1945 |
4033 `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'. | 4071 `(defun . FUNCTION)', `(autoload . SYMBOL)', and `(t . SYMBOL)'. |
4034 An element `(t . SYMBOL)' precedes an entry `(defun . FUNCTION)', | 4072 An element `(t . SYMBOL)' precedes an entry `(defun . FUNCTION)', |
4035 and means that SYMBOL was an autoload before this file redefined it | 4073 and means that SYMBOL was an autoload before this file redefined it |
4036 as a function. | 4074 as a function. |
4037 | 4075 |
4038 For a preloaded file, the file name recorded is relative to the main Lisp | 4076 During preloading, the file name recorded is relative to the main Lisp |
4039 directory. These names are converted to absolute by `file-loadhist-lookup'. */); | 4077 directory. These file names are converted to absolute at startup. */); |
4040 Vload_history = Qnil; | 4078 Vload_history = Qnil; |
4041 | 4079 |
4042 DEFVAR_LISP ("load-file-name", &Vload_file_name, | 4080 DEFVAR_LISP ("load-file-name", &Vload_file_name, |
4043 doc: /* Full name of file being loaded by `load'. */); | 4081 doc: /* Full name of file being loaded by `load'. */); |
4044 Vload_file_name = Qnil; | 4082 Vload_file_name = Qnil; |