This patch enables repeated calls to `parse-partial-sexp' with correct (nth 1 state). It is w.r.t. version of 19.33 with my patch for syntax-assist applied. *** ./src/syntax.c 1998/06/07 20:35:02 1.3 --- ./src/syntax.c 1998/06/07 21:24:00 *************** struct lisp_parse_state *** 65,70 **** --- 65,72 ---- 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. *************** scan_sexps_forward (stateptr, from, end, *** 2160,2165 **** --- 2163,2180 ---- 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; *************** scan_sexps_forward (stateptr, from, end, *** 2371,2376 **** --- 2386,2395 ---- 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 *** 2386,2392 **** 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\ --- 2405,2411 ---- 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 *** 2400,2405 **** --- 2419,2425 ---- 7. t if in a comment of style `b'; `syntax-table' if given by an explicit\n\ `syntax-table' property.\n\ 8. character address of start of last comment or string; nil if none.\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 *** 2450,2456 **** ? (state.comstyle == ST_COMMENT_STYLE ? Qsyntax_table : Qt) : Qnil, Fcons (state.comstr_start != -1 ? make_number (state.comstr_start) : Qnil, ! Qnil))))))))); } init_syntax_once () --- 2470,2476 ---- ? (state.comstyle == ST_COMMENT_STYLE ? Qsyntax_table : Qt) : Qnil, Fcons (state.comstr_start != -1 ? make_number (state.comstr_start) : Qnil, ! Fcons (state.levelstarts, Qnil)))))))))); } init_syntax_once ()