Mercurial > emacs
comparison src/textprop.c @ 109351:c8a969d13eda
merge trunk
| author | Kenichi Handa <handa@etlken> |
|---|---|
| date | Fri, 09 Jul 2010 15:55:27 +0900 |
| parents | 8cfee7d2955f |
| children | 08d10ad776d8 |
comparison
equal
deleted
inserted
replaced
| 109350:c11d07f3d731 | 109351:c8a969d13eda |
|---|---|
| 556 doc: /* Return the list of properties of the character at POSITION in OBJECT. | 556 doc: /* Return the list of properties of the character at POSITION in OBJECT. |
| 557 If the optional second argument OBJECT is a buffer (or nil, which means | 557 If the optional second argument OBJECT is a buffer (or nil, which means |
| 558 the current buffer), POSITION is a buffer position (integer or marker). | 558 the current buffer), POSITION is a buffer position (integer or marker). |
| 559 If OBJECT is a string, POSITION is a 0-based index into it. | 559 If OBJECT is a string, POSITION is a 0-based index into it. |
| 560 If POSITION is at the end of OBJECT, the value is nil. */) | 560 If POSITION is at the end of OBJECT, the value is nil. */) |
| 561 (position, object) | 561 (Lisp_Object position, Lisp_Object object) |
| 562 Lisp_Object position, object; | |
| 563 { | 562 { |
| 564 register INTERVAL i; | 563 register INTERVAL i; |
| 565 | 564 |
| 566 if (NILP (object)) | 565 if (NILP (object)) |
| 567 XSETBUFFER (object, current_buffer); | 566 XSETBUFFER (object, current_buffer); |
| 581 | 580 |
| 582 DEFUN ("get-text-property", Fget_text_property, Sget_text_property, 2, 3, 0, | 581 DEFUN ("get-text-property", Fget_text_property, Sget_text_property, 2, 3, 0, |
| 583 doc: /* Return the value of POSITION's property PROP, in OBJECT. | 582 doc: /* Return the value of POSITION's property PROP, in OBJECT. |
| 584 OBJECT is optional and defaults to the current buffer. | 583 OBJECT is optional and defaults to the current buffer. |
| 585 If POSITION is at the end of OBJECT, the value is nil. */) | 584 If POSITION is at the end of OBJECT, the value is nil. */) |
| 586 (position, prop, object) | 585 (Lisp_Object position, Lisp_Object prop, Lisp_Object object) |
| 587 Lisp_Object position, object; | |
| 588 Lisp_Object prop; | |
| 589 { | 586 { |
| 590 return textget (Ftext_properties_at (position, object), prop); | 587 return textget (Ftext_properties_at (position, object), prop); |
| 591 } | 588 } |
| 592 | 589 |
| 593 /* Return the value of char's property PROP, in OBJECT at POSITION. | 590 /* Return the value of char's property PROP, in OBJECT at POSITION. |
| 663 If POSITION is at the end of OBJECT, the value is nil. | 660 If POSITION is at the end of OBJECT, the value is nil. |
| 664 If OBJECT is a buffer, then overlay properties are considered as well as | 661 If OBJECT is a buffer, then overlay properties are considered as well as |
| 665 text properties. | 662 text properties. |
| 666 If OBJECT is a window, then that window's buffer is used, but window-specific | 663 If OBJECT is a window, then that window's buffer is used, but window-specific |
| 667 overlays are considered only if they are associated with OBJECT. */) | 664 overlays are considered only if they are associated with OBJECT. */) |
| 668 (position, prop, object) | 665 (Lisp_Object position, Lisp_Object prop, Lisp_Object object) |
| 669 Lisp_Object position, object; | |
| 670 register Lisp_Object prop; | |
| 671 { | 666 { |
| 672 return get_char_property_and_overlay (position, prop, object, 0); | 667 return get_char_property_and_overlay (position, prop, object, 0); |
| 673 } | 668 } |
| 674 | 669 |
| 675 DEFUN ("get-char-property-and-overlay", Fget_char_property_and_overlay, | 670 DEFUN ("get-char-property-and-overlay", Fget_char_property_and_overlay, |
| 684 a string, a buffer or a window. For strings, the cdr of the return | 679 a string, a buffer or a window. For strings, the cdr of the return |
| 685 value is always nil, since strings do not have overlays. If OBJECT is | 680 value is always nil, since strings do not have overlays. If OBJECT is |
| 686 a window, then that window's buffer is used, but window-specific | 681 a window, then that window's buffer is used, but window-specific |
| 687 overlays are considered only if they are associated with OBJECT. If | 682 overlays are considered only if they are associated with OBJECT. If |
| 688 POSITION is at the end of OBJECT, both car and cdr are nil. */) | 683 POSITION is at the end of OBJECT, both car and cdr are nil. */) |
| 689 (position, prop, object) | 684 (Lisp_Object position, Lisp_Object prop, Lisp_Object object) |
| 690 Lisp_Object position, object; | |
| 691 register Lisp_Object prop; | |
| 692 { | 685 { |
| 693 Lisp_Object overlay; | 686 Lisp_Object overlay; |
| 694 Lisp_Object val | 687 Lisp_Object val |
| 695 = get_char_property_and_overlay (position, prop, object, &overlay); | 688 = get_char_property_and_overlay (position, prop, object, &overlay); |
| 696 return Fcons (val, overlay); | 689 return Fcons (val, overlay); |
| 706 If none is found up to (point-max), the function returns (point-max). | 699 If none is found up to (point-max), the function returns (point-max). |
| 707 | 700 |
| 708 If the optional second argument LIMIT is non-nil, don't search | 701 If the optional second argument LIMIT is non-nil, don't search |
| 709 past position LIMIT; return LIMIT if nothing is found before LIMIT. | 702 past position LIMIT; return LIMIT if nothing is found before LIMIT. |
| 710 LIMIT is a no-op if it is greater than (point-max). */) | 703 LIMIT is a no-op if it is greater than (point-max). */) |
| 711 (position, limit) | 704 (Lisp_Object position, Lisp_Object limit) |
| 712 Lisp_Object position, limit; | |
| 713 { | 705 { |
| 714 Lisp_Object temp; | 706 Lisp_Object temp; |
| 715 | 707 |
| 716 temp = Fnext_overlay_change (position); | 708 temp = Fnext_overlay_change (position); |
| 717 if (! NILP (limit)) | 709 if (! NILP (limit)) |
| 732 If none is found since (point-min), the function returns (point-min). | 724 If none is found since (point-min), the function returns (point-min). |
| 733 | 725 |
| 734 If the optional second argument LIMIT is non-nil, don't search | 726 If the optional second argument LIMIT is non-nil, don't search |
| 735 past position LIMIT; return LIMIT if nothing is found before LIMIT. | 727 past position LIMIT; return LIMIT if nothing is found before LIMIT. |
| 736 LIMIT is a no-op if it is less than (point-min). */) | 728 LIMIT is a no-op if it is less than (point-min). */) |
| 737 (position, limit) | 729 (Lisp_Object position, Lisp_Object limit) |
| 738 Lisp_Object position, limit; | |
| 739 { | 730 { |
| 740 Lisp_Object temp; | 731 Lisp_Object temp; |
| 741 | 732 |
| 742 temp = Fprevious_overlay_change (position); | 733 temp = Fprevious_overlay_change (position); |
| 743 if (! NILP (limit)) | 734 if (! NILP (limit)) |
| 765 The property values are compared with `eq'. | 756 The property values are compared with `eq'. |
| 766 If the property is constant all the way to the end of OBJECT, return the | 757 If the property is constant all the way to the end of OBJECT, return the |
| 767 last valid position in OBJECT. | 758 last valid position in OBJECT. |
| 768 If the optional fourth argument LIMIT is non-nil, don't search | 759 If the optional fourth argument LIMIT is non-nil, don't search |
| 769 past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | 760 past position LIMIT; return LIMIT if nothing is found before LIMIT. */) |
| 770 (position, prop, object, limit) | 761 (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit) |
| 771 Lisp_Object prop, position, object, limit; | |
| 772 { | 762 { |
| 773 if (STRINGP (object)) | 763 if (STRINGP (object)) |
| 774 { | 764 { |
| 775 position = Fnext_single_property_change (position, prop, object, limit); | 765 position = Fnext_single_property_change (position, prop, object, limit); |
| 776 if (NILP (position)) | 766 if (NILP (position)) |
| 850 The property values are compared with `eq'. | 840 The property values are compared with `eq'. |
| 851 If the property is constant all the way to the start of OBJECT, return the | 841 If the property is constant all the way to the start of OBJECT, return the |
| 852 first valid position in OBJECT. | 842 first valid position in OBJECT. |
| 853 If the optional fourth argument LIMIT is non-nil, don't search | 843 If the optional fourth argument LIMIT is non-nil, don't search |
| 854 back past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | 844 back past position LIMIT; return LIMIT if nothing is found before LIMIT. */) |
| 855 (position, prop, object, limit) | 845 (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit) |
| 856 Lisp_Object prop, position, object, limit; | |
| 857 { | 846 { |
| 858 if (STRINGP (object)) | 847 if (STRINGP (object)) |
| 859 { | 848 { |
| 860 position = Fprevious_single_property_change (position, prop, object, limit); | 849 position = Fprevious_single_property_change (position, prop, object, limit); |
| 861 if (NILP (position)) | 850 if (NILP (position)) |
| 939 Return nil if the property is constant all the way to the end of OBJECT. | 928 Return nil if the property is constant all the way to the end of OBJECT. |
| 940 If the value is non-nil, it is a position greater than POSITION, never equal. | 929 If the value is non-nil, it is a position greater than POSITION, never equal. |
| 941 | 930 |
| 942 If the optional third argument LIMIT is non-nil, don't search | 931 If the optional third argument LIMIT is non-nil, don't search |
| 943 past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | 932 past position LIMIT; return LIMIT if nothing is found before LIMIT. */) |
| 944 (position, object, limit) | 933 (Lisp_Object position, Lisp_Object object, Lisp_Object limit) |
| 945 Lisp_Object position, object, limit; | |
| 946 { | 934 { |
| 947 register INTERVAL i, next; | 935 register INTERVAL i, next; |
| 948 | 936 |
| 949 if (NILP (object)) | 937 if (NILP (object)) |
| 950 XSETBUFFER (object, current_buffer); | 938 XSETBUFFER (object, current_buffer); |
| 1036 Return nil if the property is constant all the way to the end of OBJECT. | 1024 Return nil if the property is constant all the way to the end of OBJECT. |
| 1037 If the value is non-nil, it is a position greater than POSITION, never equal. | 1025 If the value is non-nil, it is a position greater than POSITION, never equal. |
| 1038 | 1026 |
| 1039 If the optional fourth argument LIMIT is non-nil, don't search | 1027 If the optional fourth argument LIMIT is non-nil, don't search |
| 1040 past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | 1028 past position LIMIT; return LIMIT if nothing is found before LIMIT. */) |
| 1041 (position, prop, object, limit) | 1029 (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit) |
| 1042 Lisp_Object position, prop, object, limit; | |
| 1043 { | 1030 { |
| 1044 register INTERVAL i, next; | 1031 register INTERVAL i, next; |
| 1045 register Lisp_Object here_val; | 1032 register Lisp_Object here_val; |
| 1046 | 1033 |
| 1047 if (NILP (object)) | 1034 if (NILP (object)) |
| 1084 Return nil if the property is constant all the way to the start of OBJECT. | 1071 Return nil if the property is constant all the way to the start of OBJECT. |
| 1085 If the value is non-nil, it is a position less than POSITION, never equal. | 1072 If the value is non-nil, it is a position less than POSITION, never equal. |
| 1086 | 1073 |
| 1087 If the optional third argument LIMIT is non-nil, don't search | 1074 If the optional third argument LIMIT is non-nil, don't search |
| 1088 back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | 1075 back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) |
| 1089 (position, object, limit) | 1076 (Lisp_Object position, Lisp_Object object, Lisp_Object limit) |
| 1090 Lisp_Object position, object, limit; | |
| 1091 { | 1077 { |
| 1092 register INTERVAL i, previous; | 1078 register INTERVAL i, previous; |
| 1093 | 1079 |
| 1094 if (NILP (object)) | 1080 if (NILP (object)) |
| 1095 XSETBUFFER (object, current_buffer); | 1081 XSETBUFFER (object, current_buffer); |
| 1133 Return nil if the property is constant all the way to the start of OBJECT. | 1119 Return nil if the property is constant all the way to the start of OBJECT. |
| 1134 If the value is non-nil, it is a position less than POSITION, never equal. | 1120 If the value is non-nil, it is a position less than POSITION, never equal. |
| 1135 | 1121 |
| 1136 If the optional fourth argument LIMIT is non-nil, don't search | 1122 If the optional fourth argument LIMIT is non-nil, don't search |
| 1137 back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) | 1123 back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) |
| 1138 (position, prop, object, limit) | 1124 (Lisp_Object position, Lisp_Object prop, Lisp_Object object, Lisp_Object limit) |
| 1139 Lisp_Object position, prop, object, limit; | |
| 1140 { | 1125 { |
| 1141 register INTERVAL i, previous; | 1126 register INTERVAL i, previous; |
| 1142 register Lisp_Object here_val; | 1127 register Lisp_Object here_val; |
| 1143 | 1128 |
| 1144 if (NILP (object)) | 1129 if (NILP (object)) |
| 1183 specifying the property values to add. If the optional fourth argument | 1168 specifying the property values to add. If the optional fourth argument |
| 1184 OBJECT is a buffer (or nil, which means the current buffer), | 1169 OBJECT is a buffer (or nil, which means the current buffer), |
| 1185 START and END are buffer positions (integers or markers). | 1170 START and END are buffer positions (integers or markers). |
| 1186 If OBJECT is a string, START and END are 0-based indices into it. | 1171 If OBJECT is a string, START and END are 0-based indices into it. |
| 1187 Return t if any property value actually changed, nil otherwise. */) | 1172 Return t if any property value actually changed, nil otherwise. */) |
| 1188 (start, end, properties, object) | 1173 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) |
| 1189 Lisp_Object start, end, properties, object; | |
| 1190 { | 1174 { |
| 1191 register INTERVAL i, unchanged; | 1175 register INTERVAL i, unchanged; |
| 1192 register int s, len, modified = 0; | 1176 register int s, len, modified = 0; |
| 1193 struct gcpro gcpro1; | 1177 struct gcpro gcpro1; |
| 1194 | 1178 |
| 1291 The third and fourth arguments PROPERTY and VALUE | 1275 The third and fourth arguments PROPERTY and VALUE |
| 1292 specify the property to add. | 1276 specify the property to add. |
| 1293 If the optional fifth argument OBJECT is a buffer (or nil, which means | 1277 If the optional fifth argument OBJECT is a buffer (or nil, which means |
| 1294 the current buffer), START and END are buffer positions (integers or | 1278 the current buffer), START and END are buffer positions (integers or |
| 1295 markers). If OBJECT is a string, START and END are 0-based indices into it. */) | 1279 markers). If OBJECT is a string, START and END are 0-based indices into it. */) |
| 1296 (start, end, property, value, object) | 1280 (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) |
| 1297 Lisp_Object start, end, property, value, object; | |
| 1298 { | 1281 { |
| 1299 Fadd_text_properties (start, end, | 1282 Fadd_text_properties (start, end, |
| 1300 Fcons (property, Fcons (value, Qnil)), | 1283 Fcons (property, Fcons (value, Qnil)), |
| 1301 object); | 1284 object); |
| 1302 return Qnil; | 1285 return Qnil; |
| 1309 If the optional fourth argument OBJECT is a buffer (or nil, which means | 1292 If the optional fourth argument OBJECT is a buffer (or nil, which means |
| 1310 the current buffer), START and END are buffer positions (integers or | 1293 the current buffer), START and END are buffer positions (integers or |
| 1311 markers). If OBJECT is a string, START and END are 0-based indices into it. | 1294 markers). If OBJECT is a string, START and END are 0-based indices into it. |
| 1312 If PROPERTIES is nil, the effect is to remove all properties from | 1295 If PROPERTIES is nil, the effect is to remove all properties from |
| 1313 the designated part of OBJECT. */) | 1296 the designated part of OBJECT. */) |
| 1314 (start, end, properties, object) | 1297 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) |
| 1315 Lisp_Object start, end, properties, object; | |
| 1316 { | 1298 { |
| 1317 return set_text_properties (start, end, properties, object, Qt); | 1299 return set_text_properties (start, end, properties, object, Qt); |
| 1318 } | 1300 } |
| 1319 | 1301 |
| 1320 | 1302 |
| 1479 the current buffer), START and END are buffer positions (integers or | 1461 the current buffer), START and END are buffer positions (integers or |
| 1480 markers). If OBJECT is a string, START and END are 0-based indices into it. | 1462 markers). If OBJECT is a string, START and END are 0-based indices into it. |
| 1481 Return t if any property was actually removed, nil otherwise. | 1463 Return t if any property was actually removed, nil otherwise. |
| 1482 | 1464 |
| 1483 Use `set-text-properties' if you want to remove all text properties. */) | 1465 Use `set-text-properties' if you want to remove all text properties. */) |
| 1484 (start, end, properties, object) | 1466 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) |
| 1485 Lisp_Object start, end, properties, object; | |
| 1486 { | 1467 { |
| 1487 register INTERVAL i, unchanged; | 1468 register INTERVAL i, unchanged; |
| 1488 register int s, len, modified = 0; | 1469 register int s, len, modified = 0; |
| 1489 | 1470 |
| 1490 if (NILP (object)) | 1471 if (NILP (object)) |
| 1565 The third argument LIST-OF-PROPERTIES is a list of property names to remove. | 1546 The third argument LIST-OF-PROPERTIES is a list of property names to remove. |
| 1566 If the optional fourth argument OBJECT is a buffer (or nil, which means | 1547 If the optional fourth argument OBJECT is a buffer (or nil, which means |
| 1567 the current buffer), START and END are buffer positions (integers or | 1548 the current buffer), START and END are buffer positions (integers or |
| 1568 markers). If OBJECT is a string, START and END are 0-based indices into it. | 1549 markers). If OBJECT is a string, START and END are 0-based indices into it. |
| 1569 Return t if any property was actually removed, nil otherwise. */) | 1550 Return t if any property was actually removed, nil otherwise. */) |
| 1570 (start, end, list_of_properties, object) | 1551 (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) |
| 1571 Lisp_Object start, end, list_of_properties, object; | |
| 1572 { | 1552 { |
| 1573 register INTERVAL i, unchanged; | 1553 register INTERVAL i, unchanged; |
| 1574 register int s, len, modified = 0; | 1554 register int s, len, modified = 0; |
| 1575 Lisp_Object properties; | 1555 Lisp_Object properties; |
| 1576 properties = list_of_properties; | 1556 properties = list_of_properties; |
| 1673 If so, return the position of the first character whose property PROPERTY | 1653 If so, return the position of the first character whose property PROPERTY |
| 1674 is `eq' to VALUE. Otherwise return nil. | 1654 is `eq' to VALUE. Otherwise return nil. |
| 1675 If the optional fifth argument OBJECT is a buffer (or nil, which means | 1655 If the optional fifth argument OBJECT is a buffer (or nil, which means |
| 1676 the current buffer), START and END are buffer positions (integers or | 1656 the current buffer), START and END are buffer positions (integers or |
| 1677 markers). If OBJECT is a string, START and END are 0-based indices into it. */) | 1657 markers). If OBJECT is a string, START and END are 0-based indices into it. */) |
| 1678 (start, end, property, value, object) | 1658 (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) |
| 1679 Lisp_Object start, end, property, value, object; | |
| 1680 { | 1659 { |
| 1681 register INTERVAL i; | 1660 register INTERVAL i; |
| 1682 register int e, pos; | 1661 register int e, pos; |
| 1683 | 1662 |
| 1684 if (NILP (object)) | 1663 if (NILP (object)) |
| 1710 If so, return the position of the first character whose property PROPERTY | 1689 If so, return the position of the first character whose property PROPERTY |
| 1711 is not `eq' to VALUE. Otherwise, return nil. | 1690 is not `eq' to VALUE. Otherwise, return nil. |
| 1712 If the optional fifth argument OBJECT is a buffer (or nil, which means | 1691 If the optional fifth argument OBJECT is a buffer (or nil, which means |
| 1713 the current buffer), START and END are buffer positions (integers or | 1692 the current buffer), START and END are buffer positions (integers or |
| 1714 markers). If OBJECT is a string, START and END are 0-based indices into it. */) | 1693 markers). If OBJECT is a string, START and END are 0-based indices into it. */) |
| 1715 (start, end, property, value, object) | 1694 (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) |
| 1716 Lisp_Object start, end, property, value, object; | |
| 1717 { | 1695 { |
| 1718 register INTERVAL i; | 1696 register INTERVAL i; |
| 1719 register int s, e; | 1697 register int s, e; |
| 1720 | 1698 |
| 1721 if (NILP (object)) | 1699 if (NILP (object)) |
