> From: Federico Tedin > Cc: casouri@gmail.com, 40000@debbugs.gnu.org > Date: Mon, 13 Apr 2020 16:20:01 +0200 > > Eli Zaretskii writes: > > > If the property is constant all the way to the end of OBJECT, return the > > last valid position in OBJECT. > > > > Your change means this will no longer be true when LIMIT > EOB. > > > > Thanks. > > Aah OK, I missed that part at the end. But if I evaluate: > > (next-single-char-property-change 0 'test "hello" 10000) > > It still returns 10000. Is it possible that "return LIMIT if nothing is > found before LIMIT" is meant to take precedence over "return the last > valid position in OBJECT"? I think this means you are dealing with "undefined behavior". Since you want to make it well-defined, the results must be consistent, where they weren't before. Note that the doc string also says this: In a string, scan runs to the end of the string, unless LIMIT is non-nil. In a buffer, if LIMIT is nil or omitted, it runs to (point-max), and the value cannot exceed that. So it's quite clear to me that the value should never be more than the last valid position, both for strings and for buffers. No doubt, no one called this function with LIMIT beyond the last valid position, because that would produce an infloop. So a change that will return the maximum valid position in this case cannot be backward-incompatible.