GNU bug report logs - #15312
Info (point-entered, point-left): Doc incomplete, hence incorrect

Previous Next

Package: emacs;

Reported by: Jambunathan K <kjambunathan <at> gmail.com>

Date: Mon, 9 Sep 2013 13:34:02 UTC

Severity: minor

Done: Jambunathan K <kjambunathan <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #74 received at 15312 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15312 <at> debbugs.gnu.org, kjambunathan <at> gmail.com
Subject: Re: bug#15312: Info (point-entered, point-left): Doc incomplete,
 hence incorrect
Date: Fri, 13 Sep 2013 22:26:07 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: kjambunathan <at> gmail.com,  15312 <at> debbugs.gnu.org
> Date: Fri, 13 Sep 2013 13:18:37 -0400
> 
> >> > Sorry, I'm still in the dark.  Does the code presented in
> >> > http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15312#11 work correctly
> >> > and as expected, or does it not?
> >> AFAICT, yes, it works fine.
> > Then please explain why it makes sense to call or not call these hooks
> > depending on whether some other unrelated text property changed at
> > point.
> 
> Hmm... I missed that part.  So it's sensitive to the C-level division
> into "struct interval"?  That would be a bug, indeed.

The problem, as I see it, is here:

  /* We run point-left and point-entered hooks here, if the
     two intervals are not equivalent.  These hooks take
     (old_point, new_point) as arguments.  */
  if (NILP (Vinhibit_point_motion_hooks)
      && (! intervals_equal (from, to)
	  || ! intervals_equal (fromprev, toprev)))
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The intervals_equal test causes the whole code below that to be
skipped if each one of the point-entered and point-left properties
don't change between position POS and POS+1, and no other properties
change between those two positions.  When some other property does
change between those two positions, the hooks are called if
point-entered is different from point-left.  (Personally, I think this
test is just an attempt to optimize costly text property comparisons
when they are not necessary.)

To get this right, we need to decide what is the correct behavior in
this case.  Do we want the hooks to be called for each point motion,
or do we want them to be called only at point-min and point-max?

The documentation is not 100% clear, but it seems to imply that the
hooks shall be called for each movement, because point-entered is
different from point-left.  FWIW, this behavior won't make sense to
me, because there's no reason for point-entered and point-left to be
identical in the general case: each one of them reacts to a different
event.  But that's me.

Depending on what we think should be the correct behavior, we may or
may not need to fix the documentation.




This bug report was last modified 11 years and 249 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.