emacs-devel
[Top][All Lists]
Advanced

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

point-[left|entered] not called when supposed to


From: Jonas Bernoulli
Subject: point-[left|entered] not called when supposed to
Date: Wed, 21 May 2008 12:16:41 +0200

In the elisp manual I found this:

     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.

However it seams that the `point-left' properties of the two points
are being compared not `point-left' to `point-entered'.

Here is some code that demonstrates this:

(defun left-entered-demo ()
  (interactive)
  (switch-to-buffer-other-window "*left-entered-demo*")
  (insert (propertize "12345"
                      'point-entered (lambda (old new)
                                       (message "entered %s" new))
                      'point-left (lambda (old new)
                                    (message "left %s" old)))))

Moving forward one character at the time all the way to the beginning
of the buffer I get this:

left 6
entered 5 [2 times]
left 2 [2 times]
entered 1

But from the description above I expect both functions to be called
twice every time the cursor moves.

I very much hope you fix the code not the documentation because I the
current behavior complicates things a lot for me.

Thx

-- Jonas




reply via email to

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