Defining and Using Fields ------------------------- A field is a range of consecutive characters in the buffer that are identified by having the same value (comparing with `eq') of the `field' property (either a text-property or an overlay property). This section describes special functions that are available for operating on fields. You specify a field with a buffer position, POS. We think of each field as containing a range of buffer positions, so the position you specify stands for the field containing that position. When the characters before and after POS are part of the same field, there is no doubt which field contains POS: the one those characters both belong to. When POS is at a boundary between fields, which field it belongs to depends on the stickiness of the `field' properties of the two surrounding characters (Note: Sticky Properties). The field whose property would be inherited by text inserted at POS is the field that contains POS. There is an anomalous case where newly inserted text at POS would not inherit the `field' property from either side. This happens if the previous character's `field' property is not rear-sticky, and the following character's `field' property is not front-sticky. In this case, POS belongs to neither the preceding field nor the following field; the field functions treat it as belonging to an empty field whose beginning and end are both at POS. In all of these functions, if POS is omitted or `nil', the value of point is used by default. - Function: field-beginning &optional pos escape-from-edge This function returns the beginning of the field specified by POS. If POS is at the beginning of its field, and ESCAPE-FROM-EDGE is non-`nil', then the return value is always the beginning of the preceding field that _ends_ at POS, regardless of the stickiness of the `field' properties around POS. - Function: field-end &optional pos escape-from-edge This function returns the end of the field specified by POS. If POS is at the end of its field, and ESCAPE-FROM-EDGE is non-`nil', then the return value is always the end of the following field that _begins_ at POS, regardless of the stickiness of the `field' properties around POS. - Function: field-string &optional pos This function returns the contents of the field specified by POS, as a string. - Function: field-string-no-properties &optional pos This function returns the contents of the field specified by POS, as a string, discarding text properties. - Function: delete-field &optional pos This function deletes the text of the field specified by POS. - Function: constrain-to-field new-pos old-pos &optional escape-from-edge only-in-line inhibit-capture-property This function "constrains" NEW-POS to the field that OLD-POS belongs to--in other words, it returns the position closest to NEW-POS that is in the same field as OLD-POS. If NEW-POS is `nil', then `constrain-to-field' uses the value of point instead, and moves point to the resulting position. If OLD-POS is at the boundary of two fields, then the acceptable positions for NEW-POS depend on the value of the optional argument ESCAPE-FROM-EDGE. If ESCAPE-FROM-EDGE is `nil', then NEW-POS is constrained to the field that has the same `field' property (either a text-property or an overlay property) that new characters inserted at OLD-POS would get. (This depends on the stickiness of the `field' property for the characters before and after OLD-POS.) If ESCAPE-FROM-EDGE is non-`nil', NEW-POS is constrained to the union of the two adjacent fields. Additionally, if two fields are separated by another field with the special value `boundary', then any point within this special field is also considered to be "on the boundary." If the optional argument ONLY-IN-LINE is non-`nil', and constraining NEW-POS in the usual way would move it to a different line, NEW-POS is returned unconstrained. This used in commands that move by line, such as `next-line' and `beginning-of-line', so that they respect field boundaries only in the case where they can still move to the right line. If the optional argument INHIBIT-CAPTURE-PROPERTY is non-`nil', and OLD-POS has a non-`nil' property of that name, then any field boundaries are ignored. You can cause `constrain-to-field' to ignore all field boundaries (and so never constrain anything) by binding the variable `inhibit-field-text-motion' to a non-nil value.
automatically generated by info2www version 220.127.116.11