aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2002-01-05 09:06:53 +0000
committerRichard M. Stallman2002-01-05 09:06:53 +0000
commitd0fc7e3b955d6fba36bef78d23a8b07b6b5a9e41 (patch)
tree7e8b35fbcc0158d06f2ffded558891199acbdc45
parentb8a8267bcbba3bb1909315031f763309245ba309 (diff)
downloademacs-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.el48
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.
431ALIST is a list of (from . to) pairs, which should be proper arguments to 431ALIST 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.
433Optional 2nd arg REVERSE, if non-nil, means the pairs are (to . from), so that 433Optional 2nd arg REVERSE, if non-nil, means the pairs are (TO . FROM), so that
434you can use the same list in both directions if it contains only literal 434you can use the same list in both directions if it contains only literal
435strings. 435strings.
436Optional args BEG and END specify a region of the buffer on which to operate." 436Optional 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.
726A region is a dotted pair (from . to). Both parameters are lists of 726A region is a dotted pair (FROM . TO). Both parameters are lists of
727regions. Each list must contain nonoverlapping, noncontiguous 727regions. Each list must contain nonoverlapping, noncontiguous
728regions, in descending order. The result is also nonoverlapping, 728regions, in descending order. The result is also nonoverlapping,
729noncontiguous, and in descending order. The first element of MINUEND 729noncontiguous, and in descending order. The first element of MINUEND
@@ -812,14 +812,14 @@ function to `format-insert-annotations'.
812Format of the TRANSLATIONS argument: 812Format of the TRANSLATIONS argument:
813 813
814Each element is a list whose car is a PROPERTY, and the following 814Each element is a list whose car is a PROPERTY, and the following
815elements are VALUES of that property followed by the names of zero or more 815elements have the form (VALUE ANNOTATIONS...).
816ANNOTATIONS. Whenever the property takes on that value, the annotations 816Whenever 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.
818When the property stops having that value, the matching negated annotation 818When the property stops having that value, the matching negated annotation
819will be inserted \(it may actually be closed earlier and reopened, if 819will be inserted \(it may actually be closed earlier and reopened, if
820necessary, to keep proper nesting). 820necessary, to keep proper nesting).
821 821
822If the property's value is a list, then each element of the list is dealt with 822If VALUE is a list, then each element of the list is dealt with
823separately. 823separately.
824 824
825If a VALUE is numeric, then it is assumed that there is a single annotation 825If 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
831specified. This function is used as a default: it is called for all 831specified. This function is used as a default: it is called for all
832transitions not explicitly listed in the table. The function is called with 832transitions not explicitly listed in the table. The function is called with
833two arguments, the OLD and NEW values of the property. It should return 833two arguments, the OLD and NEW values of the property. It should return
834lists of annotations like `format-annotate-location' does. 834a 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." 836The 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.
898If ALL is true, don't look at previous location, but generate annotations for 898If ALL is true, don't look at previous location, but generate annotations for
899all non-nil properties. 899all non-nil properties.
900Third argument IGNORE is a list of text-properties not to consider. 900Third argument IGNORE is a list of text-properties not to consider.
901Use the TRANSLATIONS alist. 901Use the TRANSLATIONS alist (see `format-annotate-region' for doc).
902 902
903Return value is a vector of 3 elements: 903Return value is a vector of 3 elements:
9041. List of names of the annotations to close 9041. List of annotations to close
9052. List of the names of annotations to open. 9052. List of annotations to open.
9063. List of properties that were ignored or couldn't be annotated." 9063. List of properties that were ignored or couldn't be annotated.
907
908The annotations in lists 1 and 2 need not be strings.
909They can be whatever the FORMAT-FN in `format-annotate-region'
910can handle. If that is `enriched-make-annotation', they can be
911either 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.
942These are searched for in the translations alist TRANS. 947These are searched for in the translations alist TRANSLATIONS
948 (see `format-annotate-region' for the format).
943If NEW does not appear in the list, but there is a default function, then that 949If NEW does not appear in the list, but there is a default function, then that
944function is called. 950function is called.
945Annotations to open and to close are returned as a dotted pair." 951Returns a cons of the form (CLOSE . OPEN)
946 (let ((prop-alist (cdr (assoc prop trans))) 952where CLOSE is a list of annotations to close
953and OPEN is a list of annotations to open.
954
955The annotations in CLOSE and OPEN need not be strings.
956They can be whatever the FORMAT-FN in `format-annotate-region'
957can handle. If that is `enriched-make-annotation', they can be
958either 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.
977PROP-ALIST is the relevant segment of a TRANSLATIONS list. 991PROP-ALIST is the relevant element of a TRANSLATIONS list.
978OLD and NEW are the values." 992OLD 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,