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

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

bug#15312: Info (point-entered, point-left): Doc incomplete, hence incor


From: Eli Zaretskii
Subject: bug#15312: Info (point-entered, point-left): Doc incomplete, hence incorrect
Date: Fri, 13 Sep 2013 22:26:07 +0300

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: kjambunathan@gmail.com,  15312@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.





reply via email to

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