aboutsummaryrefslogtreecommitdiffstats
path: root/src/lread.c
diff options
context:
space:
mode:
authorKaroly Lorentey2006-01-03 02:15:28 +0000
committerKaroly Lorentey2006-01-03 02:15:28 +0000
commitb58cb6144c59dfa3a44b9b383cf354bc2c9bebdf (patch)
tree87bc562249d9e597e12406e1d9b1c7dfb0f937e5 /src/lread.c
parentb3e6f69c10973ff7b040ced07a3a084960619681 (diff)
parent55262b16df717fe533ea4ad23dac3f02398c9055 (diff)
downloademacs-b58cb6144c59dfa3a44b9b383cf354bc2c9bebdf.tar.gz
emacs-b58cb6144c59dfa3a44b9b383cf354bc2c9bebdf.zip
Merged from miles@gnu.org--gnu-2005 (patch 682)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-682 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-490
Diffstat (limited to 'src/lread.c')
-rw-r--r--src/lread.c33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/lread.c b/src/lread.c
index 236ebebda13..0eb54393482 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1323,7 +1323,18 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1323 int count = SPECPDL_INDEX (); 1323 int count = SPECPDL_INDEX ();
1324 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1324 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
1325 struct buffer *b = 0; 1325 struct buffer *b = 0;
1326 int bpos;
1326 int continue_reading_p; 1327 int continue_reading_p;
1328 /* Nonzero if reading an entire buffer. */
1329 int whole_buffer = 0;
1330 /* 1 on the first time around. */
1331 int first_sexp = 1;
1332
1333 if (MARKERP (readcharfun))
1334 {
1335 if (NILP (start))
1336 start = readcharfun;
1337 }
1327 1338
1328 if (BUFFERP (readcharfun)) 1339 if (BUFFERP (readcharfun))
1329 b = XBUFFER (readcharfun); 1340 b = XBUFFER (readcharfun);
@@ -1349,7 +1360,6 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1349 if (b != 0 && NILP (b->name)) 1360 if (b != 0 && NILP (b->name))
1350 error ("Reading from killed buffer"); 1361 error ("Reading from killed buffer");
1351 1362
1352
1353 if (!NILP (start)) 1363 if (!NILP (start))
1354 { 1364 {
1355 /* Switch to the buffer we are reading from. */ 1365 /* Switch to the buffer we are reading from. */
@@ -1364,9 +1374,20 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1364 1374
1365 /* Set point and ZV around stuff to be read. */ 1375 /* Set point and ZV around stuff to be read. */
1366 Fgoto_char (start); 1376 Fgoto_char (start);
1367 Fnarrow_to_region (make_number (BEGV), end); 1377 if (!NILP (end))
1378 Fnarrow_to_region (make_number (BEGV), end);
1379
1380 /* Just for cleanliness, convert END to a marker
1381 if it is an integer. */
1382 if (INTEGERP (end))
1383 end = Fpoint_max_marker ();
1368 } 1384 }
1369 1385
1386 /* On the first cycle, we can easily test here
1387 whether we are reading the whole buffer. */
1388 if (b && first_sexp)
1389 whole_buffer = (PT == BEG && ZV == Z);
1390
1370 instream = stream; 1391 instream = stream;
1371 read_next: 1392 read_next:
1372 c = READCHAR; 1393 c = READCHAR;
@@ -1416,8 +1437,11 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1416 1437
1417 if (!NILP (start) && continue_reading_p) 1438 if (!NILP (start) && continue_reading_p)
1418 start = Fpoint_marker (); 1439 start = Fpoint_marker ();
1440
1441 /* Restore saved point and BEGV. */
1419 unbind_to (count1, Qnil); 1442 unbind_to (count1, Qnil);
1420 1443
1444 /* Now eval what we just read. */
1421 val = (*evalfun) (val); 1445 val = (*evalfun) (val);
1422 1446
1423 if (printflag) 1447 if (printflag)
@@ -1428,11 +1452,12 @@ readevalloop (readcharfun, stream, sourcename, evalfun,
1428 else 1452 else
1429 Fprint (val, Qnil); 1453 Fprint (val, Qnil);
1430 } 1454 }
1455
1456 first_sexp = 0;
1431 } 1457 }
1432 1458
1433 build_load_history (sourcename, 1459 build_load_history (sourcename,
1434 stream || (INTEGERP (start) && INTEGERP (end) 1460 stream || whole_buffer);
1435 && XINT (start) == BEG && XINT (end) == Z));
1436 1461
1437 UNGCPRO; 1462 UNGCPRO;
1438 1463