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

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

Re: [patch] text property `point-entered': function called to often


From: Stefan Monnier
Subject: Re: [patch] text property `point-entered': function called to often
Date: Sun, 02 Mar 2003 15:30:17 -0500

> [I have the vague feeling that I have reported this before.  Either
> this or I have a deja vu.  My apologies if the former is the
> case.]
> 
> >From the Emacs Lisp Reference:
> 
> ,----[ Text => Text Properties => Special Properties ]
> | `point-entered'
> | `point-left'
> |      The special properties `point-entered' and `point-left' record
> |      hook functions that report motion of point.  Each time point
> |      moves, Emacs compares these two property values:
> | 
> |         * the `point-left' property of the character after the old
> |           location, and
> | 
> |         * the `point-entered' property of the character after the new
> |           location.
> | 
> |      If these two values differ, each of them is called (if not `nil')
> |      with two arguments: the old value of point, and the new one.
> `----
> 
> According to this, Emacs should *not* call the function that is the
> value of those text properties, if the value at the old location and
> the value at the new one are `eq'. This BTW is already suggested by
> the names `point-left' and `point-entered'.
> 
> But Emacs calls this function _each_ time point moves.

Actually, it doesn't.  It calls it when point hits the text-property
and a second time when point leaves the non-text-propertized area,
but it doesn't call it when moving inside the text.
I.e. it calls it once when reaching the edge of the propertized
text and a second time when reaching the inside of it.

The problem is that text-properties apply to chars while point
is always between two chars.  This is why there is a fromprev
and toprev which hold the proplist before the from position
and before the to position (as opposed to from and to which hold
the proplist after the from and to positions).

Have you taken a look at the various users of those properties
to see whether your patch would have an impact (beneficial maybe)
on their code ?

I think the cleanest behavior would be to rely on the stickiness
of the point-left (or point-entered) property to determine when
the call the function (either when reaching the edge or when
reaching the inside of the text).


        Stefan





reply via email to

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