bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Stefan Monnier
Subject: bug#17181: 24.4.50; previous-single-property-change: odd behavior
Date: Thu, 03 Apr 2014 22:27:56 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]