comparison src/extents.c @ 207:e45d5e7c476e r20-4b2

Import from CVS: tag r20-4b2
author cvs
date Mon, 13 Aug 2007 10:03:52 +0200
parents 850242ba4a81
children 78478c60bfcd
comparison
equal deleted inserted replaced
206:d3e9274cbc4e 207:e45d5e7c476e
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 Lisp_Object Qinitial_redisplay_function;
450 450
451 Lisp_Object Qglyph_layout; /* This exists only for backwards compatibility. */ 451 Lisp_Object Qglyph_layout; /* This exists only for backwards compatibility. */
452 Lisp_Object Qbegin_glyph_layout, Qend_glyph_layout; 452 Lisp_Object Qbegin_glyph_layout, Qend_glyph_layout;
453 Lisp_Object Qoutside_margin; 453 Lisp_Object Qoutside_margin;
454 Lisp_Object Qinside_margin; 454 Lisp_Object Qinside_margin;
931 ((markobj) (data->end_glyph)); 931 ((markobj) (data->end_glyph));
932 ((markobj) (data->invisible)); 932 ((markobj) (data->invisible));
933 ((markobj) (data->children)); 933 ((markobj) (data->children));
934 ((markobj) (data->read_only)); 934 ((markobj) (data->read_only));
935 ((markobj) (data->mouse_face)); 935 ((markobj) (data->mouse_face));
936 ((markobj) (data->one_shot_function)); 936 ((markobj) (data->initial_redisplay_function));
937 return data->parent; 937 return data->parent;
938 } 938 }
939 939
940 void 940 void
941 allocate_extent_auxiliary (EXTENT ext) 941 allocate_extent_auxiliary (EXTENT ext)
1645 if (!NILP (extent_face (anc)) || 1645 if (!NILP (extent_face (anc)) ||
1646 !NILP (extent_begin_glyph (anc)) || 1646 !NILP (extent_begin_glyph (anc)) ||
1647 !NILP (extent_end_glyph (anc)) || 1647 !NILP (extent_end_glyph (anc)) ||
1648 !NILP (extent_mouse_face (anc)) || 1648 !NILP (extent_mouse_face (anc)) ||
1649 !NILP (extent_invisible (anc)) || 1649 !NILP (extent_invisible (anc)) ||
1650 !NILP (extent_one_shot_function (anc)) || 1650 !NILP (extent_initial_redisplay_function (anc)) ||
1651 invisibility_change) 1651 invisibility_change)
1652 extent_changed_for_redisplay (extent, descendants_too, 1652 extent_changed_for_redisplay (extent, descendants_too,
1653 invisibility_change); 1653 invisibility_change);
1654 } 1654 }
1655 1655
2883 mouse_highlight_priority); 2883 mouse_highlight_priority);
2884 extent_face (&dummy_lhe_extent) = extent_mouse_face (lhe); 2884 extent_face (&dummy_lhe_extent) = extent_mouse_face (lhe);
2885 Dynarr_add (ef->extents, &dummy_lhe_extent); 2885 Dynarr_add (ef->extents, &dummy_lhe_extent);
2886 } 2886 }
2887 /* since we are looping anyway, we might as well do this here */ 2887 /* since we are looping anyway, we might as well do this here */
2888 if (!NILP(extent_one_shot_function (e))) 2888 if ((!NILP(extent_initial_redisplay_function (e))) &&
2889 !extent_in_red_event_p(e))
2889 { 2890 {
2890 Lisp_Object function = extent_one_shot_function (e); 2891 Lisp_Object function = extent_initial_redisplay_function (e);
2891 Lisp_Object obj; 2892 Lisp_Object obj;
2892 2893
2893 /* printf("One shot function called!\n "); */ 2894 /* printf("initial redisplay function called!\n "); */
2894 2895
2895 /* print_extent_2(e); 2896 /* print_extent_2(e);
2896 printf("\n"); */ 2897 printf("\n"); */
2897 2898
2898 /* Do NOT use the set function here because that sets the 2899 /* FIXME: One should probably inhibit the displaying of
2899 redisplay flag.
2900 FIXME: One should probably inhibit the displaying of
2901 this extent to reduce flicker */ 2900 this extent to reduce flicker */
2902 set_extent_one_shot_function (e,Qnil); /* one shot */ 2901 extent_in_red_event_p(e) = 1;
2903 2902
2904 /* call the function */ 2903 /* call the function */
2905 XSETEXTENT(obj,e); 2904 XSETEXTENT(obj,e);
2906 if(!NILP(function)) 2905 if(!NILP(function))
2907 Fenqueue_eval_event(function,obj); 2906 Fenqueue_eval_event(function,obj);
4770 (memoize_extent_face_internal (value))); 4769 (memoize_extent_face_internal (value)));
4771 return value; 4770 return value;
4772 } 4771 }
4773 4772
4774 /* Do we need a lisp-level function ? */ 4773 /* Do we need a lisp-level function ? */
4775 DEFUN ("set-extent-one-shot-function", Fset_extent_one_shot_function, 4774 DEFUN ("set-extent-initial-redisplay-function", Fset_extent_initial_redisplay_function,
4776 2,2,0,/* 4775 2,2,0,/*
4777 Set one-shot-function of EXTENT to the function 4776 Note: This feature is experimental!
4778 FUNCTION. This function will be called with EXTENT as its only 4777
4779 argument shortly after (part of) the extent has been under 4778 Set initial-redisplay-function of EXTENT to the function
4780 consideration for display. The property is then cleared. 4779 FUNCTION.
4780
4781 The first time the EXTENT is (re)displayed, an eval event will be
4782 dispatched calling FUNCTION with EXTENT as its only argument.
4781 */ 4783 */
4782 (extent, function)) 4784 (extent, function))
4783 { 4785 {
4784 EXTENT e = decode_extent(extent, DE_MUST_BE_ATTACHED); 4786 EXTENT e = decode_extent(extent, DE_MUST_BE_ATTACHED);
4785 4787
4786 e = extent_ancestor (e); /* Is this needed? Macro also does chasing!*/ 4788 e = extent_ancestor (e); /* Is this needed? Macro also does chasing!*/
4787 set_extent_one_shot_function(e,function); 4789 set_extent_initial_redisplay_function(e,function);
4790 extent_in_red_event_p(e) = 0; /* If the function changed we can spawn
4791 new events */
4788 extent_changed_for_redisplay(e,1,0); /* Do we need to mark children too ?*/ 4792 extent_changed_for_redisplay(e,1,0); /* Do we need to mark children too ?*/
4789 4793
4790 return function; 4794 return function;
4791 } 4795 }
4792 4796
5088 By default, extents have the `end-open' but not the 5092 By default, extents have the `end-open' but not the
5089 `start-open' property set. 5093 `start-open' property set.
5090 5094
5091 read-only Text within this extent will be unmodifiable. 5095 read-only Text within this extent will be unmodifiable.
5092 5096
5093 one-shot-function function to be called the first time (part of) the extent 5097 initial-redisplay-function (EXPERIMENTAL)
5098 function to be called the first time (part of) the extent
5094 is redisplayed. It will be called with the extent as its 5099 is redisplayed. It will be called with the extent as its
5095 first argument. 5100 first argument.
5101 Note: The function will not be called immediately
5102 during redisplay, an eval event will be dispatched.
5096 5103
5097 detachable Whether the extent gets detached (as with 5104 detachable Whether the extent gets detached (as with
5098 `detach-extent') when all the text within the 5105 `detach-extent') when all the text within the
5099 extent is deleted. This is true by default. If 5106 extent is deleted. This is true by default. If
5100 this property is not set, the extent becomes a 5107 this property is not set, the extent becomes a
5223 } 5230 }
5224 else if (EQ (property, Qpriority)) 5231 else if (EQ (property, Qpriority))
5225 Fset_extent_priority (extent, value); 5232 Fset_extent_priority (extent, value);
5226 else if (EQ (property, Qface)) 5233 else if (EQ (property, Qface))
5227 Fset_extent_face (extent, value); 5234 Fset_extent_face (extent, value);
5228 else if (EQ (property, Qone_shot_function)) 5235 else if (EQ (property, Qinitial_redisplay_function))
5229 Fset_extent_one_shot_function (extent, value); 5236 Fset_extent_initial_redisplay_function (extent, value);
5230 else if (EQ (property, Qmouse_face)) 5237 else if (EQ (property, Qmouse_face))
5231 Fset_extent_mouse_face (extent, value); 5238 Fset_extent_mouse_face (extent, value);
5232 /* Obsolete: */ 5239 /* Obsolete: */
5233 else if (EQ (property, Qhighlight)) 5240 else if (EQ (property, Qhighlight))
5234 Fset_extent_mouse_face (extent, Qhighlight); 5241 Fset_extent_mouse_face (extent, Qhighlight);
5262 set_extent_openness (e, start_open, end_open); 5269 set_extent_openness (e, start_open, end_open);
5263 } 5270 }
5264 else 5271 else
5265 { 5272 {
5266 if (EQ (property, Qkeymap)) 5273 if (EQ (property, Qkeymap))
5267 while (NILP (Fkeymapp (value))) 5274 while (!NILP (value) && NILP (Fkeymapp (value)))
5268 value = wrong_type_argument (Qkeymapp, value); 5275 value = wrong_type_argument (Qkeymapp, value);
5269 5276
5270 external_plist_put (extent_plist_addr (e), property, value, 0, ERROR_ME); 5277 external_plist_put (extent_plist_addr (e), property, value, 0, ERROR_ME);
5271 } 5278 }
5272 5279
5329 return extent_read_only (e); 5336 return extent_read_only (e);
5330 else if (EQ (property, Qinvisible)) 5337 else if (EQ (property, Qinvisible))
5331 return extent_invisible (e); 5338 return extent_invisible (e);
5332 else if (EQ (property, Qface)) 5339 else if (EQ (property, Qface))
5333 return Fextent_face (extent); 5340 return Fextent_face (extent);
5334 else if (EQ (property, Qone_shot_function)) 5341 else if (EQ (property, Qinitial_redisplay_function))
5335 return extent_one_shot_function (e); 5342 return extent_initial_redisplay_function (e);
5336 else if (EQ (property, Qmouse_face)) 5343 else if (EQ (property, Qmouse_face))
5337 return Fextent_mouse_face (extent); 5344 return Fextent_mouse_face (extent);
5338 /* Obsolete: */ 5345 /* Obsolete: */
5339 else if (EQ (property, Qhighlight)) 5346 else if (EQ (property, Qhighlight))
5340 return !NILP (Fextent_mouse_face (extent)) ? Qt : Qnil; 5347 return !NILP (Fextent_mouse_face (extent)) ? Qt : Qnil;
5408 5415
5409 if (extent_priority (anc) != 0) 5416 if (extent_priority (anc) != 0)
5410 result = Fcons (Qpriority, Fcons (make_int (extent_priority (anc)), 5417 result = Fcons (Qpriority, Fcons (make_int (extent_priority (anc)),
5411 result)); 5418 result));
5412 5419
5413 if (!NILP (extent_one_shot_function (anc))) 5420 if (!NILP (extent_initial_redisplay_function (anc)))
5414 result = Fcons (Qone_shot_function, Fcons (extent_one_shot_function (anc), result)); 5421 result = Fcons (Qinitial_redisplay_function, Fcons (extent_initial_redisplay_function (anc), result));
5415 5422
5416 if (!NILP (extent_invisible (anc))) 5423 if (!NILP (extent_invisible (anc)))
5417 result = Fcons (Qinvisible, Fcons (extent_invisible (anc), result)); 5424 result = Fcons (Qinvisible, Fcons (extent_invisible (anc), result));
5418 5425
5419 if (!NILP (extent_read_only (anc))) 5426 if (!NILP (extent_read_only (anc)))
6624 defsymbol (&Qunique, "unique"); 6631 defsymbol (&Qunique, "unique");
6625 defsymbol (&Qduplicable, "duplicable"); 6632 defsymbol (&Qduplicable, "duplicable");
6626 defsymbol (&Qdetachable, "detachable"); 6633 defsymbol (&Qdetachable, "detachable");
6627 defsymbol (&Qpriority, "priority"); 6634 defsymbol (&Qpriority, "priority");
6628 defsymbol (&Qmouse_face, "mouse-face"); 6635 defsymbol (&Qmouse_face, "mouse-face");
6629 defsymbol (&Qone_shot_function,"one-shot-function"); 6636 defsymbol (&Qinitial_redisplay_function,"initial-redisplay-function");
6630 6637
6631 6638
6632 defsymbol (&Qglyph_layout, "glyph-layout"); /* backwards compatibility */ 6639 defsymbol (&Qglyph_layout, "glyph-layout"); /* backwards compatibility */
6633 defsymbol (&Qbegin_glyph_layout, "begin-glyph-layout"); 6640 defsymbol (&Qbegin_glyph_layout, "begin-glyph-layout");
6634 defsymbol (&Qbegin_glyph_layout, "end-glyph-layout"); 6641 defsymbol (&Qbegin_glyph_layout, "end-glyph-layout");
6678 DEFSUBR (Fextent_in_region_p); 6685 DEFSUBR (Fextent_in_region_p);
6679 DEFSUBR (Fmap_extents); 6686 DEFSUBR (Fmap_extents);
6680 DEFSUBR (Fmap_extent_children); 6687 DEFSUBR (Fmap_extent_children);
6681 DEFSUBR (Fextent_at); 6688 DEFSUBR (Fextent_at);
6682 6689
6683 DEFSUBR (Fset_extent_one_shot_function); 6690 DEFSUBR (Fset_extent_initial_redisplay_function);
6684 DEFSUBR (Fextent_face); 6691 DEFSUBR (Fextent_face);
6685 DEFSUBR (Fset_extent_face); 6692 DEFSUBR (Fset_extent_face);
6686 DEFSUBR (Fextent_mouse_face); 6693 DEFSUBR (Fextent_mouse_face);
6687 DEFSUBR (Fset_extent_mouse_face); 6694 DEFSUBR (Fset_extent_mouse_face);
6688 DEFSUBR (Fset_extent_begin_glyph); 6695 DEFSUBR (Fset_extent_begin_glyph);
6753 extent_auxiliary_defaults.children = Qnil; 6760 extent_auxiliary_defaults.children = Qnil;
6754 extent_auxiliary_defaults.priority = 0; 6761 extent_auxiliary_defaults.priority = 0;
6755 extent_auxiliary_defaults.invisible = Qnil; 6762 extent_auxiliary_defaults.invisible = Qnil;
6756 extent_auxiliary_defaults.read_only = Qnil; 6763 extent_auxiliary_defaults.read_only = Qnil;
6757 extent_auxiliary_defaults.mouse_face = Qnil; 6764 extent_auxiliary_defaults.mouse_face = Qnil;
6758 extent_auxiliary_defaults.one_shot_function = Qnil; 6765 extent_auxiliary_defaults.initial_redisplay_function = Qnil;
6759 } 6766 }
6760 6767
6761 void 6768 void
6762 complex_vars_of_extents (void) 6769 complex_vars_of_extents (void)
6763 { 6770 {