diff options
| author | Richard M. Stallman | 2002-01-05 09:06:53 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-01-05 09:06:53 +0000 |
| commit | d0fc7e3b955d6fba36bef78d23a8b07b6b5a9e41 (patch) | |
| tree | 7e8b35fbcc0158d06f2ffded558891199acbdc45 | |
| parent | b8a8267bcbba3bb1909315031f763309245ba309 (diff) | |
| download | emacs-d0fc7e3b955d6fba36bef78d23a8b07b6b5a9e41.tar.gz emacs-d0fc7e3b955d6fba36bef78d23a8b07b6b5a9e41.zip | |
(format-replace-strings, format-subtract-regions)
(format-annotate-region, format-annotate-location)
(format-annotate-atomic-property-change)
(format-annotate-single-property-change): Doc fixes.
| -rw-r--r-- | lisp/format.el | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/lisp/format.el b/lisp/format.el index 811c0c2f1b2..d5b4c859d8a 100644 --- a/lisp/format.el +++ b/lisp/format.el | |||
| @@ -428,9 +428,9 @@ Formats are defined in `format-alist'. Optional arg is the PROMPT to use." | |||
| 428 | 428 | ||
| 429 | (defun format-replace-strings (alist &optional reverse beg end) | 429 | (defun format-replace-strings (alist &optional reverse beg end) |
| 430 | "Do multiple replacements on the buffer. | 430 | "Do multiple replacements on the buffer. |
| 431 | ALIST is a list of (from . to) pairs, which should be proper arguments to | 431 | ALIST is a list of (FROM . TO) pairs, which should be proper arguments to |
| 432 | `search-forward' and `replace-match' respectively. | 432 | `search-forward' and `replace-match' respectively. |
| 433 | Optional 2nd arg REVERSE, if non-nil, means the pairs are (to . from), so that | 433 | Optional 2nd arg REVERSE, if non-nil, means the pairs are (TO . FROM), so that |
| 434 | you can use the same list in both directions if it contains only literal | 434 | you can use the same list in both directions if it contains only literal |
| 435 | strings. | 435 | strings. |
| 436 | Optional args BEG and END specify a region of the buffer on which to operate." | 436 | Optional args BEG and END specify a region of the buffer on which to operate." |
| @@ -723,7 +723,7 @@ to write these unknown annotations back into the file." | |||
| 723 | 723 | ||
| 724 | (defun format-subtract-regions (minu subtra) | 724 | (defun format-subtract-regions (minu subtra) |
| 725 | "Remove from the regions in MINUend the regions in SUBTRAhend. | 725 | "Remove from the regions in MINUend the regions in SUBTRAhend. |
| 726 | A region is a dotted pair (from . to). Both parameters are lists of | 726 | A region is a dotted pair (FROM . TO). Both parameters are lists of |
| 727 | regions. Each list must contain nonoverlapping, noncontiguous | 727 | regions. Each list must contain nonoverlapping, noncontiguous |
| 728 | regions, in descending order. The result is also nonoverlapping, | 728 | regions, in descending order. The result is also nonoverlapping, |
| 729 | noncontiguous, and in descending order. The first element of MINUEND | 729 | noncontiguous, and in descending order. The first element of MINUEND |
| @@ -812,14 +812,14 @@ function to `format-insert-annotations'. | |||
| 812 | Format of the TRANSLATIONS argument: | 812 | Format of the TRANSLATIONS argument: |
| 813 | 813 | ||
| 814 | Each element is a list whose car is a PROPERTY, and the following | 814 | Each element is a list whose car is a PROPERTY, and the following |
| 815 | elements are VALUES of that property followed by the names of zero or more | 815 | elements have the form (VALUE ANNOTATIONS...). |
| 816 | ANNOTATIONS. Whenever the property takes on that value, the annotations | 816 | Whenever the property takes on the value VALUE, the annotations |
| 817 | \(as formatted by FORMAT-FN) are inserted into the file. | 817 | \(as formatted by FORMAT-FN) are inserted into the file. |
| 818 | When the property stops having that value, the matching negated annotation | 818 | When the property stops having that value, the matching negated annotation |
| 819 | will be inserted \(it may actually be closed earlier and reopened, if | 819 | will be inserted \(it may actually be closed earlier and reopened, if |
| 820 | necessary, to keep proper nesting). | 820 | necessary, to keep proper nesting). |
| 821 | 821 | ||
| 822 | If the property's value is a list, then each element of the list is dealt with | 822 | If VALUE is a list, then each element of the list is dealt with |
| 823 | separately. | 823 | separately. |
| 824 | 824 | ||
| 825 | If a VALUE is numeric, then it is assumed that there is a single annotation | 825 | If a VALUE is numeric, then it is assumed that there is a single annotation |
| @@ -831,9 +831,9 @@ If the VALUE is nil, then instead of annotations, a function should be | |||
| 831 | specified. This function is used as a default: it is called for all | 831 | specified. This function is used as a default: it is called for all |
| 832 | transitions not explicitly listed in the table. The function is called with | 832 | transitions not explicitly listed in the table. The function is called with |
| 833 | two arguments, the OLD and NEW values of the property. It should return | 833 | two arguments, the OLD and NEW values of the property. It should return |
| 834 | lists of annotations like `format-annotate-location' does. | 834 | a cons cell (CLOSE . OPEN) as `format-annotate-single-property-change' does. |
| 835 | 835 | ||
| 836 | The same structure can be used in reverse for reading files." | 836 | The same TRANSLATIONS structure can be used in reverse for reading files." |
| 837 | (let ((all-ans nil) ; All annotations - becomes return value | 837 | (let ((all-ans nil) ; All annotations - becomes return value |
| 838 | (open-ans nil) ; Annotations not yet closed | 838 | (open-ans nil) ; Annotations not yet closed |
| 839 | (loc nil) ; Current location | 839 | (loc nil) ; Current location |
| @@ -898,12 +898,17 @@ This includes any properties that change between LOC-1 and LOC. | |||
| 898 | If ALL is true, don't look at previous location, but generate annotations for | 898 | If ALL is true, don't look at previous location, but generate annotations for |
| 899 | all non-nil properties. | 899 | all non-nil properties. |
| 900 | Third argument IGNORE is a list of text-properties not to consider. | 900 | Third argument IGNORE is a list of text-properties not to consider. |
| 901 | Use the TRANSLATIONS alist. | 901 | Use the TRANSLATIONS alist (see `format-annotate-region' for doc). |
| 902 | 902 | ||
| 903 | Return value is a vector of 3 elements: | 903 | Return value is a vector of 3 elements: |
| 904 | 1. List of names of the annotations to close | 904 | 1. List of annotations to close |
| 905 | 2. List of the names of annotations to open. | 905 | 2. List of annotations to open. |
| 906 | 3. List of properties that were ignored or couldn't be annotated." | 906 | 3. List of properties that were ignored or couldn't be annotated. |
| 907 | |||
| 908 | The annotations in lists 1 and 2 need not be strings. | ||
| 909 | They can be whatever the FORMAT-FN in `format-annotate-region' | ||
| 910 | can handle. If that is `enriched-make-annotation', they can be | ||
| 911 | either strings, or lists of the form (PARAMETER VALUE)." | ||
| 907 | (let* ((prev-loc (1- loc)) | 912 | (let* ((prev-loc (1- loc)) |
| 908 | (before-plist (if all nil (text-properties-at prev-loc))) | 913 | (before-plist (if all nil (text-properties-at prev-loc))) |
| 909 | (after-plist (text-properties-at loc)) | 914 | (after-plist (text-properties-at loc)) |
| @@ -937,13 +942,22 @@ Return value is a vector of 3 elements: | |||
| 937 | positives (nconc positives (cdr result))))))))) | 942 | positives (nconc positives (cdr result))))))))) |
| 938 | (vector negatives positives not-found))) | 943 | (vector negatives positives not-found))) |
| 939 | 944 | ||
| 940 | (defun format-annotate-single-property-change (prop old new trans) | 945 | (defun format-annotate-single-property-change (prop old new translations) |
| 941 | "Return annotations for property PROP changing from OLD to NEW. | 946 | "Return annotations for property PROP changing from OLD to NEW. |
| 942 | These are searched for in the translations alist TRANS. | 947 | These are searched for in the translations alist TRANSLATIONS |
| 948 | (see `format-annotate-region' for the format). | ||
| 943 | If NEW does not appear in the list, but there is a default function, then that | 949 | If NEW does not appear in the list, but there is a default function, then that |
| 944 | function is called. | 950 | function is called. |
| 945 | Annotations to open and to close are returned as a dotted pair." | 951 | Returns a cons of the form (CLOSE . OPEN) |
| 946 | (let ((prop-alist (cdr (assoc prop trans))) | 952 | where CLOSE is a list of annotations to close |
| 953 | and OPEN is a list of annotations to open. | ||
| 954 | |||
| 955 | The annotations in CLOSE and OPEN need not be strings. | ||
| 956 | They can be whatever the FORMAT-FN in `format-annotate-region' | ||
| 957 | can handle. If that is `enriched-make-annotation', they can be | ||
| 958 | either strings, or lists of the form (PARAMETER VALUE)." | ||
| 959 | |||
| 960 | (let ((prop-alist (cdr (assoc prop translations))) | ||
| 947 | default) | 961 | default) |
| 948 | (if (not prop-alist) | 962 | (if (not prop-alist) |
| 949 | nil | 963 | nil |
| @@ -974,7 +988,7 @@ Annotations to open and to close are returned as a dotted pair." | |||
| 974 | 988 | ||
| 975 | (defun format-annotate-atomic-property-change (prop-alist old new) | 989 | (defun format-annotate-atomic-property-change (prop-alist old new) |
| 976 | "Internal function annotate a single property change. | 990 | "Internal function annotate a single property change. |
| 977 | PROP-ALIST is the relevant segment of a TRANSLATIONS list. | 991 | PROP-ALIST is the relevant element of a TRANSLATIONS list. |
| 978 | OLD and NEW are the values." | 992 | OLD and NEW are the values." |
| 979 | (let (num-ann) | 993 | (let (num-ann) |
| 980 | ;; If old and new values are numbers, | 994 | ;; If old and new values are numbers, |