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

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

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


From: Oliver Scholz
Subject: [CVS] [patch] text property `point-entered': function called to often
Date: Fri, 28 Feb 2003 17:20:20 +0100
User-agent: Gnus/5.090016 (Oort Gnus v0.16) Emacs/21.3.50

[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.

(progn
  (switch-to-buffer (generate-new-buffer "*tmp*"))
  (insert "test   ")
  (put-text-property 1 5 
                     'point-entered
                     (lambda (old new)
                       (message "%s %s" old new))))


Now move point to backward into the word "test". Each time you move
point then, the `lambda' function is called. The same would be true
for `point-left'.

The attached patch seems to fix this.

Beware! I don't understand intervals.c fully yet, as I don't
understand the rest of Emacs' internals yet. This patch seems to fix
the bug, but I don't know whether it breaks anything.

    Oliver

Attachment: intervals.diff
Description: Text Data

-- 
Oliver Scholz               10 Ventôse an 211 de la Révolution
Taunusstr. 25               Liberté, Egalité, Fraternité!
60329 Frankfurt a. M.       http://www.jungdemokratenhessen.de
Tel. (069) 97 40 99 42      http://www.jdjl.org

reply via email to

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