Hi Stephen,
Thanks for moving that to xemacs-beta. I found some time to dig deeper
into that issue. I quoted my original message below for people who
didn't follow comp.emacs.xemacs (probably most of you ;-)
I wrote:
Try this:
,----
| This is an extent.
|
| (setq ex (make-extent 1 19))
| (set-extent-face ex 'holiday-face) ; some face with a background color
`----
Now move point to the `.' at position 18. According to the docs this
is still part of the extent and the background color also indicates
that. Now type C-t (transpose-chars) and notice that the extent
shrinks to the new end position 17! I would have expected the new end
position to be 18. Also the dot which is now at position 18, is not
part of the extent anymore.
Also if there are any after-change-functions associated to the extent,
they won't get called if point is at 18 and the command C-d
(delete-char) is being called.
You were close with the bug in transpose-chars which is just a wrapper
for transpose-subr. This is where the funny behaviour comes from. What
transpose-subr does is:
1. delete string following point (thus modifying the end-open extent)
2. insert string preceeding point (placing it outside the extent)
3. insert string deleted in 1. before string inserted in 2. (placing
it outside the extent)
4. delete string preceeding point
Taking my example above the steps are
This is an extent-!-.
This is an extent-!-
This is an extentt-!-
This is an exten-!-t
This is an exten.-!-t
Wow that's a lot just to swap two strings before and after point ;-)
I consider this behaviour buggy because it has totally unexpected
results even for someone who *does* now about corner-cases at
extent-endpoints. In the example above, two characters that had been
snugly inside the extent find themselves outside the extent for no
good reason.
My statement about the -- still unoffical -- after-change-functions
extent property is *not* related to the bug described above. I assume
that extent after-change-functions are implemented using the buffer
after-change-functions, which would show that behaviour unless extents
and their positions are being carefully kept track of. I sent Hrvoje a
more detailed email about that, since he apparently implemented that
feature.
Best regards,
Marcus