comparison src/extents.c @ 189:489f57a838ef r20-3b21

Import from CVS: tag r20-3b21
author cvs
date Mon, 13 Aug 2007 09:57:07 +0200
parents 3d6bfa290dbd
children a2f645c6b9f8
comparison
equal deleted inserted replaced
188:e29a8e7498d9 189:489f57a838ef
444 Lisp_Object Qunique; 444 Lisp_Object Qunique;
445 Lisp_Object Qduplicable; 445 Lisp_Object Qduplicable;
446 Lisp_Object Qdetachable; 446 Lisp_Object Qdetachable;
447 Lisp_Object Qpriority; 447 Lisp_Object Qpriority;
448 Lisp_Object Qmouse_face; 448 Lisp_Object Qmouse_face;
449 Lisp_Object Qone_shot_function;
449 450
450 Lisp_Object Qglyph_layout; /* This exists only for backwards compatibility. */ 451 Lisp_Object Qglyph_layout; /* This exists only for backwards compatibility. */
451 Lisp_Object Qbegin_glyph_layout, Qend_glyph_layout; 452 Lisp_Object Qbegin_glyph_layout, Qend_glyph_layout;
452 Lisp_Object Qoutside_margin; 453 Lisp_Object Qoutside_margin;
453 Lisp_Object Qinside_margin; 454 Lisp_Object Qinside_margin;
930 ((markobj) (data->end_glyph)); 931 ((markobj) (data->end_glyph));
931 ((markobj) (data->invisible)); 932 ((markobj) (data->invisible));
932 ((markobj) (data->children)); 933 ((markobj) (data->children));
933 ((markobj) (data->read_only)); 934 ((markobj) (data->read_only));
934 ((markobj) (data->mouse_face)); 935 ((markobj) (data->mouse_face));
936 ((markobj) (data->one_shot_function));
935 return data->parent; 937 return data->parent;
936 } 938 }
937 939
938 void 940 void
939 allocate_extent_auxiliary (EXTENT ext) 941 allocate_extent_auxiliary (EXTENT ext)
1643 if (!NILP (extent_face (anc)) || 1645 if (!NILP (extent_face (anc)) ||
1644 !NILP (extent_begin_glyph (anc)) || 1646 !NILP (extent_begin_glyph (anc)) ||
1645 !NILP (extent_end_glyph (anc)) || 1647 !NILP (extent_end_glyph (anc)) ||
1646 !NILP (extent_mouse_face (anc)) || 1648 !NILP (extent_mouse_face (anc)) ||
1647 !NILP (extent_invisible (anc)) || 1649 !NILP (extent_invisible (anc)) ||
1650 !NILP (extent_one_shot_function (anc)) ||
1648 invisibility_change) 1651 invisibility_change)
1649 extent_changed_for_redisplay (extent, descendants_too, 1652 extent_changed_for_redisplay (extent, descendants_too,
1650 invisibility_change); 1653 invisibility_change);
1651 } 1654 }
1652 1655
2878 set_extent_priority (&dummy_lhe_extent, 2881 set_extent_priority (&dummy_lhe_extent,
2879 mouse_highlight_priority); 2882 mouse_highlight_priority);
2880 extent_face (&dummy_lhe_extent) = extent_mouse_face (lhe); 2883 extent_face (&dummy_lhe_extent) = extent_mouse_face (lhe);
2881 Dynarr_add (ef->extents, &dummy_lhe_extent); 2884 Dynarr_add (ef->extents, &dummy_lhe_extent);
2882 } 2885 }
2886 /* since we are looping anyway, we might as well do this here */
2887 if (!NILP(extent_one_shot_function (e)))
2888 {
2889 Lisp_Object function = extent_one_shot_function (e);
2890 Lisp_Object obj;
2891
2892 /* printf("One shot function called!\n "); */
2893
2894 /* print_extent_2(e);
2895 printf("\n"); */
2896
2897 /* Do NOT use the set function here because that sets the
2898 redisplay flag.
2899 FIXME: One should probably inhibit the displaying of
2900 this extent to reduce flicker */
2901 set_extent_one_shot_function (e,Qnil); /* one shot */
2902
2903 /* call the function */
2904 XSETEXTENT(obj,e);
2905 if(!NILP(function))
2906 Fenqueue_eval_event(function,obj);
2907 }
2883 } 2908 }
2884 } 2909 }
2885 2910
2886 extent_fragment_sort_by_priority (ef->extents); 2911 extent_fragment_sort_by_priority (ef->extents);
2887 2912
4743 value = (external_of_internal_memoized_face 4768 value = (external_of_internal_memoized_face
4744 (memoize_extent_face_internal (value))); 4769 (memoize_extent_face_internal (value)));
4745 return value; 4770 return value;
4746 } 4771 }
4747 4772
4773 /* Do we need a lisp-level function ? */
4774 DEFUN ("set-extent-one-shot-function", Fset_extent_one_shot_function,
4775 2,2,0,/*
4776 Set one-shot-function of EXTENT to the function
4777 FUNCTION. This function will be called with EXTENT as its only
4778 argument shortly after (part of) the extent has been under
4779 consideration for display. The property is then cleared.
4780 */
4781 (extent, function))
4782 {
4783 EXTENT e = decode_extent(extent, DE_MUST_BE_ATTACHED);
4784
4785 e = extent_ancestor (e); /* Is this needed? Macro also does chasing!*/
4786 set_extent_one_shot_function(e,function);
4787 extent_changed_for_redisplay(e,1,0); /* Do we need to mark children too ?*/
4788
4789 return function;
4790 }
4791
4792
4793
4794
4748 DEFUN ("extent-face", Fextent_face, 1, 1, 0, /* 4795 DEFUN ("extent-face", Fextent_face, 1, 1, 0, /*
4749 Return the name of the face in which EXTENT is displayed, or nil 4796 Return the name of the face in which EXTENT is displayed, or nil
4750 if the extent's face is unspecified. This might also return a list 4797 if the extent's face is unspecified. This might also return a list
4751 of face names. 4798 of face names.
4752 */ 4799 */
4753 (extent)) 4800 (extent))
4754 { 4801 {
4755 Lisp_Object face; 4802 Lisp_Object face;
4756 4803
5040 By default, extents have the `end-open' but not the 5087 By default, extents have the `end-open' but not the
5041 `start-open' property set. 5088 `start-open' property set.
5042 5089
5043 read-only Text within this extent will be unmodifiable. 5090 read-only Text within this extent will be unmodifiable.
5044 5091
5092 one-shot-function function to be called the first time (part of) the extent
5093 is redisplayed. It will be called with the extent as its
5094 first argument.
5095
5045 detachable Whether the extent gets detached (as with 5096 detachable Whether the extent gets detached (as with
5046 `detach-extent') when all the text within the 5097 `detach-extent') when all the text within the
5047 extent is deleted. This is true by default. If 5098 extent is deleted. This is true by default. If
5048 this property is not set, the extent becomes a 5099 this property is not set, the extent becomes a
5049 zero-length extent when its text is deleted. (In 5100 zero-length extent when its text is deleted. (In
5171 } 5222 }
5172 else if (EQ (property, Qpriority)) 5223 else if (EQ (property, Qpriority))
5173 Fset_extent_priority (extent, value); 5224 Fset_extent_priority (extent, value);
5174 else if (EQ (property, Qface)) 5225 else if (EQ (property, Qface))
5175 Fset_extent_face (extent, value); 5226 Fset_extent_face (extent, value);
5227 else if (EQ (property, Qone_shot_function))
5228 Fset_extent_one_shot_function (extent, value);
5176 else if (EQ (property, Qmouse_face)) 5229 else if (EQ (property, Qmouse_face))
5177 Fset_extent_mouse_face (extent, value); 5230 Fset_extent_mouse_face (extent, value);
5178 /* Obsolete: */ 5231 /* Obsolete: */
5179 else if (EQ (property, Qhighlight)) 5232 else if (EQ (property, Qhighlight))
5180 Fset_extent_mouse_face (extent, Qhighlight); 5233 Fset_extent_mouse_face (extent, Qhighlight);
5249 return extent_read_only (e); 5302 return extent_read_only (e);
5250 else if (EQ (property, Qinvisible)) 5303 else if (EQ (property, Qinvisible))
5251 return extent_invisible (e); 5304 return extent_invisible (e);
5252 else if (EQ (property, Qface)) 5305 else if (EQ (property, Qface))
5253 return Fextent_face (extent); 5306 return Fextent_face (extent);
5307 else if (EQ (property, Qone_shot_function))
5308 return extent_one_shot_function (e);
5254 else if (EQ (property, Qmouse_face)) 5309 else if (EQ (property, Qmouse_face))
5255 return Fextent_mouse_face (extent); 5310 return Fextent_mouse_face (extent);
5256 /* Obsolete: */ 5311 /* Obsolete: */
5257 else if (EQ (property, Qhighlight)) 5312 else if (EQ (property, Qhighlight))
5258 return !NILP (Fextent_mouse_face (extent)) ? Qt : Qnil; 5313 return !NILP (Fextent_mouse_face (extent)) ? Qt : Qnil;
5325 result = Fcons (Qbegin_glyph, Fcons (extent_begin_glyph (anc), result)); 5380 result = Fcons (Qbegin_glyph, Fcons (extent_begin_glyph (anc), result));
5326 5381
5327 if (extent_priority (anc) != 0) 5382 if (extent_priority (anc) != 0)
5328 result = Fcons (Qpriority, Fcons (make_int (extent_priority (anc)), 5383 result = Fcons (Qpriority, Fcons (make_int (extent_priority (anc)),
5329 result)); 5384 result));
5385
5386 if (!NILP (extent_one_shot_function (anc)))
5387 result = Fcons (Qone_shot_function, Fcons (extent_one_shot_function (anc), result));
5330 5388
5331 if (!NILP (extent_invisible (anc))) 5389 if (!NILP (extent_invisible (anc)))
5332 result = Fcons (Qinvisible, Fcons (extent_invisible (anc), result)); 5390 result = Fcons (Qinvisible, Fcons (extent_invisible (anc), result));
5333 5391
5334 if (!NILP (extent_read_only (anc))) 5392 if (!NILP (extent_read_only (anc)))
6539 defsymbol (&Qunique, "unique"); 6597 defsymbol (&Qunique, "unique");
6540 defsymbol (&Qduplicable, "duplicable"); 6598 defsymbol (&Qduplicable, "duplicable");
6541 defsymbol (&Qdetachable, "detachable"); 6599 defsymbol (&Qdetachable, "detachable");
6542 defsymbol (&Qpriority, "priority"); 6600 defsymbol (&Qpriority, "priority");
6543 defsymbol (&Qmouse_face, "mouse-face"); 6601 defsymbol (&Qmouse_face, "mouse-face");
6602 defsymbol (&Qone_shot_function,"one-shot-function");
6603
6544 6604
6545 defsymbol (&Qglyph_layout, "glyph-layout"); /* backwards compatibility */ 6605 defsymbol (&Qglyph_layout, "glyph-layout"); /* backwards compatibility */
6546 defsymbol (&Qbegin_glyph_layout, "begin-glyph-layout"); 6606 defsymbol (&Qbegin_glyph_layout, "begin-glyph-layout");
6547 defsymbol (&Qbegin_glyph_layout, "end-glyph-layout"); 6607 defsymbol (&Qbegin_glyph_layout, "end-glyph-layout");
6548 defsymbol (&Qoutside_margin, "outside-margin"); 6608 defsymbol (&Qoutside_margin, "outside-margin");
6591 DEFSUBR (Fextent_in_region_p); 6651 DEFSUBR (Fextent_in_region_p);
6592 DEFSUBR (Fmap_extents); 6652 DEFSUBR (Fmap_extents);
6593 DEFSUBR (Fmap_extent_children); 6653 DEFSUBR (Fmap_extent_children);
6594 DEFSUBR (Fextent_at); 6654 DEFSUBR (Fextent_at);
6595 6655
6656 DEFSUBR (Fset_extent_one_shot_function);
6596 DEFSUBR (Fextent_face); 6657 DEFSUBR (Fextent_face);
6597 DEFSUBR (Fset_extent_face); 6658 DEFSUBR (Fset_extent_face);
6598 DEFSUBR (Fextent_mouse_face); 6659 DEFSUBR (Fextent_mouse_face);
6599 DEFSUBR (Fset_extent_mouse_face); 6660 DEFSUBR (Fset_extent_mouse_face);
6600 DEFSUBR (Fset_extent_begin_glyph); 6661 DEFSUBR (Fset_extent_begin_glyph);
6664 extent_auxiliary_defaults.children = Qnil; 6725 extent_auxiliary_defaults.children = Qnil;
6665 extent_auxiliary_defaults.priority = 0; 6726 extent_auxiliary_defaults.priority = 0;
6666 extent_auxiliary_defaults.invisible = Qnil; 6727 extent_auxiliary_defaults.invisible = Qnil;
6667 extent_auxiliary_defaults.read_only = Qnil; 6728 extent_auxiliary_defaults.read_only = Qnil;
6668 extent_auxiliary_defaults.mouse_face = Qnil; 6729 extent_auxiliary_defaults.mouse_face = Qnil;
6730 extent_auxiliary_defaults.one_shot_function = Qnil;
6669 } 6731 }
6670 6732
6671 void 6733 void
6672 complex_vars_of_extents (void) 6734 complex_vars_of_extents (void)
6673 { 6735 {