unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* point-[left|entered] not called when supposed to
@ 2008-05-21 10:16 Jonas Bernoulli
  2008-05-21 14:28 ` Miles Bader
  0 siblings, 1 reply; 2+ messages in thread
From: Jonas Bernoulli @ 2008-05-21 10:16 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: point-[left|entered] not called when supposed to
  2008-05-21 10:16 point-[left|entered] not called when supposed to Jonas Bernoulli
@ 2008-05-21 14:28 ` Miles Bader
  0 siblings, 0 replies; 2+ messages in thread
From: Miles Bader @ 2008-05-21 14:28 UTC (permalink / raw)
  To: Jonas Bernoulli; +Cc: emacs-devel

"Jonas Bernoulli" <jonas@bernoulli.cc> writes:
> I very much hope you fix the code not the documentation because I the
> current behavior complicates things a lot for me.

It looks to me like it's a documentation bug (if that).

The intent of the properties seems reasonably clear -- to allow hooks to
be called when point moves across a _boundary_ in the text -- and the
interpretation you apparently want doesn't even make much sense.[*]

[*] The two properties will almost always be different from each other
(because it's presumably desirable for different actions to take place
upon entry and exit from a block of text), so your [apparent]
interpretation would result in them being called for all movement, even
within a region, and that contracts the names of the properties.

-Miles

-- 
(\(\
(^.^)
(")")
*This is the cute bunny virus, please copy this into your sig so it can spread.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-21 14:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21 10:16 point-[left|entered] not called when supposed to Jonas Bernoulli
2008-05-21 14:28 ` Miles Bader

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).