emacs-devel
[Top][All Lists]
Advanced

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

text-property/intervals question


From: Miles Bader
Subject: text-property/intervals question
Date: 15 Nov 2001 23:20:02 +0900

Is it legal for a `struct interval' to have a total_length field of 0?

I was debugging Alex Schroeder's problem with overlays in comint
buffers, and when I did:

   M-x global-font-lock-mode
   M-x shell
   M-x ansi-color-for-comint-mode-on

and then in the shell buffer:

   ls --color /tmp

Emacs hung.

Upon investigation, it turns out that Fprevious_single_char_property_change
was looping infinitely because Fprevious_property_change was returning
a position the same as its argument (which it's not supposed to do).

The reason is because in this code from Fprevious_property_change:

  /* Start with the interval containing the char before point.  */
  if (i->position == XFASTINT (position))
    i = previous_interval (i);

it turns out that the previous interval had a total_length field of 0,
and so the previous interval was at the same position as `i'!

If zero-length intervals are legal (I didn't think they were), then I
suppose this could be fixed by changing the `if' to `while', but if they
aren't legal, there's something funny going on.  However, I don't
really understand this code, so I'd appreciate any advice or help.

Thanks,

-Miles
-- 
80% of success is just showing up.  --Woody Allen



reply via email to

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