How can I get the previous-or-equal single property change for a given property? For example, assume
CCC below have different
Here is the return value that I would like to get for each position:
Contrast to what
Essentially, the problem is that
(previous-single-char-property-change (point-max) 'face) returns
4 instead of
7. I thought I could just use
(previous-single-char-property-change (1+ (point) 'face) instead, but that breaks on
How can I achieve get the previous-or-equal single char property change, taking into account the starting position?
Here is some code to reproduce the example:
(with-current-buffer (get-buffer-create "*test*") (erase-buffer) (insert "AAABBBCCC") (mapc #'delete-overlay (overlays-in (point-min) (point-max))) (overlay-put (make-overlay 1 4) 'face '(:background "red")) (overlay-put (make-overlay 4 7) 'face '(:background "blue")) (overlay-put (make-overlay 7 10) 'face '(:background "green")) (pop-to-buffer (current-buffer)))
Some background: for a major mode that I'm writing I need to read information from the overlay (if any) that precedes (and does not cover) the current point.