Mercurial > emacs
diff src/lread.c @ 90140:02f1dbc4a199
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-35
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 228-240)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 53-58)
- Merge from emacs--cvs-trunk--0
- Update from CVS
- Collapse feature addition/removal within single ChangeLog entry
author | Miles Bader <miles@gnu.org> |
---|---|
date | Sat, 09 Apr 2005 02:16:29 +0000 |
parents | 7e3f621f1dd4 008bb0675c5b |
children | 146c086df160 |
line wrap: on
line diff
--- a/src/lread.c Sat Apr 09 01:45:41 2005 +0000 +++ b/src/lread.c Sat Apr 09 02:16:29 2005 +0000 @@ -218,6 +218,7 @@ static void readevalloop P_ ((Lisp_Object, FILE*, Lisp_Object, Lisp_Object (*) (), int, + Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)); static Lisp_Object load_unwind P_ ((Lisp_Object)); static Lisp_Object load_descriptor_unwind P_ ((Lisp_Object)); @@ -1097,14 +1098,15 @@ = Fcons (make_number (fileno (stream)), load_descriptor_list); load_in_progress++; if (! version || version >= 22) - readevalloop (Qget_file_char, stream, file, Feval, 0, Qnil, Qnil); + readevalloop (Qget_file_char, stream, file, Feval, + 0, Qnil, Qnil, Qnil, Qnil); else { /* We can't handle a file which was compiled with byte-compile-dynamic by older version of Emacs. */ specbind (Qload_force_doc_strings, Qt); - readevalloop (Qget_emacs_mule_file_char, stream, file, Feval, 0, - Qnil, Qnil); + readevalloop (Qget_emacs_mule_file_char, stream, file, Feval, + 0, Qnil, Qnil, Qnil, Qnil); } unbind_to (count, Qnil); @@ -1483,16 +1485,19 @@ /* UNIBYTE specifies how to set load_convert_to_unibyte for this invocation. - READFUN, if non-nil, is used instead of `read'. */ + READFUN, if non-nil, is used instead of `read'. + START, END is region in current buffer (from eval-region). */ static void -readevalloop (readcharfun, stream, sourcename, evalfun, printflag, unibyte, readfun) +readevalloop (readcharfun, stream, sourcename, evalfun, + printflag, unibyte, readfun, start, end) Lisp_Object readcharfun; FILE *stream; Lisp_Object sourcename; Lisp_Object (*evalfun) (); int printflag; Lisp_Object unibyte, readfun; + Lisp_Object start, end; { register int c; register Lisp_Object val; @@ -1518,28 +1523,41 @@ continue_reading_p = 1; while (continue_reading_p) { + int count1 = SPECPDL_INDEX (); + if (b != 0 && NILP (b->name)) error ("Reading from killed buffer"); + if (!NILP (start)) + { + record_unwind_protect (save_excursion_restore, save_excursion_save ()); + record_unwind_protect (save_restriction_restore, save_restriction_save ()); + Fgoto_char (start); + Fnarrow_to_region (make_number (BEGV), end); + } + instream = stream; + read_next: c = READCHAR; if (c == ';') { while ((c = READCHAR) != '\n' && c != -1); - continue; + goto read_next; } - if (c < 0) break; + if (c < 0) + { + unbind_to (count1, Qnil); + break; + } /* Ignore whitespace here, so we can detect eof. */ if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r') - continue; + goto read_next; if (!NILP (Vpurify_flag) && c == '(') { - int count1 = SPECPDL_INDEX (); record_unwind_protect (unreadpure, Qnil); val = read_list (-1, readcharfun); - unbind_to (count1, Qnil); } else { @@ -1565,6 +1583,10 @@ val = read_internal_start (readcharfun, Qnil, Qnil); } + if (!NILP (start) && continue_reading_p) + start = Fpoint_marker (); + unbind_to (count1, Qnil); + val = (*evalfun) (val); if (printflag) @@ -1623,7 +1645,8 @@ specbind (Qstandard_output, tem); record_unwind_protect (save_excursion_restore, save_excursion_save ()); BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); - readevalloop (buf, 0, filename, Feval, !NILP (printflag), unibyte, Qnil); + readevalloop (buf, 0, filename, Feval, + !NILP (printflag), unibyte, Qnil, Qnil, Qnil); unbind_to (count, Qnil); return Qnil; @@ -1655,15 +1678,10 @@ tem = printflag; specbind (Qstandard_output, tem); - if (NILP (printflag)) - record_unwind_protect (save_excursion_restore, save_excursion_save ()); - record_unwind_protect (save_restriction_restore, save_restriction_save ()); - - /* This both uses start and checks its type. */ - Fgoto_char (start); - Fnarrow_to_region (make_number (BEGV), end); + /* readevalloop calls functions which check the type of start and end. */ readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, - !NILP (printflag), Qnil, read_function); + !NILP (printflag), Qnil, read_function, + start, end); return unbind_to (count, Qnil); }