*** ./src/syntax.c.orig	Thu Jun  4 16:59:38 1998
--- ./src/syntax.c	Sun Jun  7 19:37:46 1998
*************** struct lisp_parse_state
*** 43,48 ****
--- 43,50 ----
      int location;	/* Char number at which parsing stopped.  */
      int mindepth;	/* Minimum depth seen while scanning.  */
      int comstr_start;	/* Position just after last comment/string starter.  */
+     Lisp_Object levelstarts;	/* Char numbers of starts-of-expression
+ 				   of levels (starting from outermost).  */
    };
  
  /* These variables are a cache for finding the start of a defun.
*************** do { prev_from = from;				\
*** 2339,2344 ****
--- 2341,2358 ----
        oldstate = Fcdr (oldstate);
        tem = Fcar (oldstate);
        state.comstr_start = NILP (tem) ? -1 : XINT (tem) ;
+       oldstate = Fcdr (oldstate);
+       tem = Fcar (oldstate);
+       while (!NILP (tem))		/* >= second enclosing sexps.  */
+ 	{
+ 	  /* curlevel++->last ran into compiler bug on Apollo */
+ 	  curlevel->last = XINT (Fcar (tem));
+ 	  if (++curlevel == endlevel)
+ 	    error ("Nesting too deep for parser");
+ 	  curlevel->prev = -1;
+ 	  curlevel->last = -1;
+ 	  tem = Fcdr (tem);
+ 	}
      }
    state.quoted = 0;
    mindepth = depth;
*************** do { prev_from = from;				\
*** 2574,2579 ****
--- 2588,2597 ----
    state.prevlevelstart
      = (curlevel == levelstart) ? -1 : (curlevel - 1)->last;
    state.location = from;
+   state.levelstarts = Qnil;
+   while (--curlevel >= levelstart)
+       state.levelstarts = Fcons (make_number (curlevel->last),
+ 				 state.levelstarts);
    immediate_quit = 0;
  
    *stateptr = state;
*************** Parsing stops at TO or when certain crit
*** 2589,2595 ****
   point is set to where parsing stops.\n\
  If fifth arg STATE is omitted or nil,\n\
   parsing assumes that FROM is the beginning of a function.\n\
! Value is a list of nine elements describing final state of parsing:\n\
   0. depth in parens.\n\
   1. character address of start of innermost containing list; nil if none.\n\
   2. character address of start of last complete sexp terminated.\n\
--- 2607,2613 ----
   point is set to where parsing stops.\n\
  If fifth arg STATE is omitted or nil,\n\
   parsing assumes that FROM is the beginning of a function.\n\
! Value is a list of ten elements describing final state of parsing:\n\
   0. depth in parens.\n\
   1. character address of start of innermost containing list; nil if none.\n\
   2. character address of start of last complete sexp terminated.\n\
*************** Value is a list of nine elements describ
*** 2602,2607 ****
--- 2620,2626 ----
   7. t if in a comment of style b; `syntax-table' if the comment\n\
      should be terminated by a generic comment delimiter.\n\
   8. character address of start of comment or string; nil if not in one.\n\
+  9. Intermediate data for continuation of parsing (subject to change).\n\
  If third arg TARGETDEPTH is non-nil, parsing stops if the depth\n\
  in parentheses becomes equal to TARGETDEPTH.\n\
  Fourth arg STOPBEFORE non-nil means stop when come to\n\
*************** DEFUN ("parse-partial-sexp", Fparse_part
*** 2656,2662 ****
  			      Fcons ((state.incomment || state.instring
  				      ? make_number (state.comstr_start)
  				      : Qnil),
! 				     Qnil)))))))));
  }
  
  void
--- 2675,2681 ----
  			      Fcons ((state.incomment || state.instring
  				      ? make_number (state.comstr_start)
  				      : Qnil),
! 				     Fcons (state.levelstarts, Qnil))))))))));
  }
  
  void