comparison src/textprop.c @ 55652:2e649bd1c696

(get_char_property_and_overlay): Use GET_OVERLAYS_AT.
author Kim F. Storm <storm@cua.dk>
date Mon, 17 May 2004 22:48:07 +0000
parents c90162ba57c6
children c4f6faab46b0 4c90ffeb71c5
comparison
equal deleted inserted replaced
55651:dcb7d888bb38 55652:2e649bd1c696
635 w = XWINDOW (object); 635 w = XWINDOW (object);
636 object = w->buffer; 636 object = w->buffer;
637 } 637 }
638 if (BUFFERP (object)) 638 if (BUFFERP (object))
639 { 639 {
640 int posn = XINT (position);
641 int noverlays; 640 int noverlays;
642 Lisp_Object *overlay_vec, tem; 641 Lisp_Object *overlay_vec;
643 int len;
644 struct buffer *obuf = current_buffer; 642 struct buffer *obuf = current_buffer;
645 643
646 set_buffer_temp (XBUFFER (object)); 644 set_buffer_temp (XBUFFER (object));
647 645
648 /* First try with room for 40 overlays. */ 646 GET_OVERLAYS_AT (XINT (position), overlay_vec, noverlays, NULL, 0);
649 len = 40;
650 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
651
652 noverlays = overlays_at (posn, 0, &overlay_vec, &len,
653 NULL, NULL, 0);
654
655 /* If there are more than 40,
656 make enough space for all, and try again. */
657 if (noverlays > len)
658 {
659 len = noverlays;
660 overlay_vec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object));
661 noverlays = overlays_at (posn, 0, &overlay_vec, &len,
662 NULL, NULL, 0);
663 }
664 noverlays = sort_overlays (overlay_vec, noverlays, w); 647 noverlays = sort_overlays (overlay_vec, noverlays, w);
665 648
666 set_buffer_temp (obuf); 649 set_buffer_temp (obuf);
667 650
668 /* Now check the overlays in order of decreasing priority. */ 651 /* Now check the overlays in order of decreasing priority. */
669 while (--noverlays >= 0) 652 while (--noverlays >= 0)
670 { 653 {
671 tem = Foverlay_get (overlay_vec[noverlays], prop); 654 Lisp_Object tem = Foverlay_get (overlay_vec[noverlays], prop);
672 if (!NILP (tem)) 655 if (!NILP (tem))
673 { 656 {
674 if (overlay) 657 if (overlay)
675 /* Return the overlay we got the property from. */ 658 /* Return the overlay we got the property from. */
676 *overlay = overlay_vec[noverlays]; 659 *overlay = overlay_vec[noverlays];