\f
* Incompatible Lisp Changes in Emacs 28.1
+---
+** 'parse-partial-sexp' now signals an error it TO is smaller than FROM.
+Previously this would lead to the function interpreting FROM as TO and
+vice versa, which would be confusing when passing in OLDSTATE, which
+refers to the old state at FROM.
+
+++
** 'overlays-in' now handles zero-length overlays slightly differently.
Previosly, zero-length overlays at the end of the buffer were included
doc: /* Parse Lisp syntax starting at FROM until TO; return status of parse at TO.
Parsing stops at TO or when certain criteria are met;
point is set to where parsing stops.
-If fifth arg OLDSTATE is omitted or nil,
- parsing assumes that FROM is the beginning of a function.
+
+If OLDSTATE is omitted or nil, parsing assumes that FROM is the
+ beginning of a function. If not, OLDSTATE should be the state at
+ FROM.
Value is a list of elements describing final state of parsing:
0. depth in parens.
else
target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth. */
+ if (XFIXNUM (to) < XFIXNUM (from))
+ error ("End position should be larger than start position.");
+
validate_region (&from, &to);
internalize_parse_state (oldstate, &state);
scan_sexps_forward (&state, XFIXNUM (from), CHAR_TO_BYTE (XFIXNUM (from)),
(syntax-pps-comments /* 56 76 77 58)
(syntax-pps-comments /* 60 78 79)
+(ert-deftest test-from-to-parse-partial-sexp ()
+ (with-temp-buffer
+ (insert "foo")
+ (should (parse-partial-sexp 1 1))
+ (should-error (parse-partial-sexp 2 1))))
+
;;; syntax-tests.el ends here