Subject: Re: bug#17181: 24.4.50; previous-single-property-change: odd behavior

From: Stefan Monnier <[email-masked]>
Date: Thu, 03 Apr 2014 22:27:56 -0400

tags 17181 notabug
thanks

> (put-text-property (point) (point-max) 'test t)
> Move point to the front of "bar" ie  point is at the beginning of the
> line.
> (get-text-property (point) 'test) returns T as expected.
> (point) evaluates to 6
> Consequently, I'd  expect 
> (previous-single-property-change (point) 'test) to return 5 
> instead you get: nil

Buffer positions are *between* characters.  `get-text-property' gets you
the value of the property on "the character after point".
`previous-single-property-change' gets you the nearest change on
*previous* characters.  The property above is nil between point-min and
point, so previous-single-property-change finds no change at all.

The off-by-one error is in your expectations :-(

        Stefan