aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThien-Thi Nguyen2006-08-02 22:51:44 +0000
committerThien-Thi Nguyen2006-08-02 22:51:44 +0000
commit1200843820a76d33eeb0386cd617feec55a247f0 (patch)
tree0a248e70551ff76e45e8f239317e890bcfc8d667
parentd2f00838a139465c7d0d49fe83eee36902943f13 (diff)
downloademacs-1200843820a76d33eeb0386cd617feec55a247f0.tar.gz
emacs-1200843820a76d33eeb0386cd617feec55a247f0.zip
Docstring style and grammar tweaks; nfc.
-rw-r--r--lisp/format.el76
1 files changed, 38 insertions, 38 deletions
diff --git a/lisp/format.el b/lisp/format.el
index 58c69575d36..66eca0c2ac2 100644
--- a/lisp/format.el
+++ b/lisp/format.el
@@ -117,17 +117,17 @@ DOC-STR should be a single line providing more information about the
117 117
118REGEXP is a regular expression to match against the beginning of the file; 118REGEXP is a regular expression to match against the beginning of the file;
119 it should match only files in that format. Use nil to avoid 119 it should match only files in that format. Use nil to avoid
120 matching at all for formats for which this isn't appropriate to 120 matching at all for formats for which it isn't appropriate to
121 require explicit encoding/decoding. 121 require explicit encoding/decoding.
122 122
123FROM-FN is called to decode files in that format; it gets two args, BEGIN 123FROM-FN is called to decode files in that format; it takes two args, BEGIN
124 and END, and can make any modifications it likes, returning the new 124 and END, and can make any modifications it likes, returning the new
125 end. It must make sure that the beginning of the file no longer 125 end. It must make sure that the beginning of the file no longer
126 matches REGEXP, or else it will get called again. 126 matches REGEXP, or else it will get called again.
127 Alternatively, FROM-FN can be a string, which specifies a shell command 127 Alternatively, FROM-FN can be a string, which specifies a shell command
128 (including options) to be used as a filter to perform the conversion. 128 (including options) to be used as a filter to perform the conversion.
129 129
130TO-FN is called to encode a region into that format; it is passed three 130TO-FN is called to encode a region into that format; it takes three
131 arguments: BEGIN, END, and BUFFER. BUFFER is the original buffer that 131 arguments: BEGIN, END, and BUFFER. BUFFER is the original buffer that
132 the data being written came from, which the function could use, for 132 the data being written came from, which the function could use, for
133 example, to find the values of local variables. TO-FN should either 133 example, to find the values of local variables. TO-FN should either
@@ -142,7 +142,7 @@ MODIFY, if non-nil, means the TO-FN wants to modify the region. If nil,
142 142
143MODE-FN, if specified, is called when visiting a file with that format. 143MODE-FN, if specified, is called when visiting a file with that format.
144 It is called with a single positive argument, on the assumption 144 It is called with a single positive argument, on the assumption
145 that it turns on some Emacs mode. 145 that this would turn on some minor mode.
146 146
147PRESERVE, if non-nil, means that `format-write-file' should not remove 147PRESERVE, if non-nil, means that `format-write-file' should not remove
148 this format from `buffer-file-formats'.") 148 this format from `buffer-file-formats'.")
@@ -150,8 +150,8 @@ PRESERVE, if non-nil, means that `format-write-file' should not remove
150;;; Basic Functions (called from Lisp) 150;;; Basic Functions (called from Lisp)
151 151
152(defun format-encode-run-method (method from to &optional buffer) 152(defun format-encode-run-method (method from to &optional buffer)
153 "Translate using function or shell script METHOD the text from FROM to TO. 153 "Translate using METHOD the text from FROM to TO.
154If METHOD is a string, it is a shell command; 154If METHOD is a string, it is a shell command (including options);
155otherwise, it should be a Lisp function. 155otherwise, it should be a Lisp function.
156BUFFER should be the buffer that the output originally came from." 156BUFFER should be the buffer that the output originally came from."
157 (if (stringp method) 157 (if (stringp method)
@@ -173,9 +173,9 @@ BUFFER should be the buffer that the output originally came from."
173 (funcall method from to buffer))) 173 (funcall method from to buffer)))
174 174
175(defun format-decode-run-method (method from to &optional buffer) 175(defun format-decode-run-method (method from to &optional buffer)
176 "Decode using function or shell script METHOD the text from FROM to TO. 176 "Decode using METHOD the text from FROM to TO.
177If METHOD is a string, it is a shell command; otherwise, it should be 177If METHOD is a string, it is a shell command (including options); otherwise,
178a Lisp function. Decoding is done for the given BUFFER." 178it should be a Lisp function. Decoding is done for the given BUFFER."
179 (if (stringp method) 179 (if (stringp method)
180 (let ((error-buff (get-buffer-create "*Format Errors*")) 180 (let ((error-buff (get-buffer-create "*Format Errors*"))
181 (coding-system-for-write 'no-conversion) 181 (coding-system-for-write 'no-conversion)
@@ -200,15 +200,15 @@ a Lisp function. Decoding is done for the given BUFFER."
200 200
201(defun format-annotate-function (format from to orig-buf format-count) 201(defun format-annotate-function (format from to orig-buf format-count)
202 "Return annotations for writing region as FORMAT. 202 "Return annotations for writing region as FORMAT.
203FORMAT is a symbol naming one of the formats defined in `format-alist', 203FORMAT is a symbol naming one of the formats defined in `format-alist'.
204it must be a single symbol, not a list like `buffer-file-format'. 204It must be a single symbol, not a list like `buffer-file-format'.
205FROM and TO delimit the region to be operated on in the current buffer. 205FROM and TO delimit the region to be operated on in the current buffer.
206ORIG-BUF is the original buffer that the data came from. 206ORIG-BUF is the original buffer that the data came from.
207 207
208FORMAT-COUNT is an integer specifying how many times this function has 208FORMAT-COUNT is an integer specifying how many times this function has
209been called in the process of decoding ORIG-BUF. 209been called in the process of decoding ORIG-BUF.
210 210
211This function works like a function on `write-region-annotate-functions': 211This function works like a function in `write-region-annotate-functions':
212it either returns a list of annotations, or returns with a different buffer 212it either returns a list of annotations, or returns with a different buffer
213current, which contains the modified text to write. In the latter case, 213current, which contains the modified text to write. In the latter case,
214this function's value is nil. 214this function's value is nil.
@@ -253,7 +253,7 @@ If optional third arg VISIT-FLAG is true, set `buffer-file-format'
253to the reverted list of formats used, and call any mode functions defined 253to the reverted list of formats used, and call any mode functions defined
254for those formats. 254for those formats.
255 255
256Returns the new length of the decoded region. 256Return the new length of the decoded region.
257 257
258For most purposes, consider using `format-decode-region' instead." 258For most purposes, consider using `format-decode-region' instead."
259 (let ((mod (buffer-modified-p)) 259 (let ((mod (buffer-modified-p))
@@ -312,9 +312,9 @@ For most purposes, consider using `format-decode-region' instead."
312 312
313(defun format-decode-buffer (&optional format) 313(defun format-decode-buffer (&optional format)
314 "Translate the buffer from some FORMAT. 314 "Translate the buffer from some FORMAT.
315If the format is not specified, this function attempts to guess. 315If the format is not specified, attempt a regexp-based guess.
316`buffer-file-format' is set to the format used, and any mode-functions 316Set `buffer-file-format' to the format used, and call any
317for the format are called." 317format-specific mode functions."
318 (interactive 318 (interactive
319 (list (format-read "Translate buffer from format (default guess): "))) 319 (list (format-read "Translate buffer from format (default guess): ")))
320 (save-excursion 320 (save-excursion
@@ -343,7 +343,7 @@ formats defined in `format-alist', or a list of such symbols."
343 343
344(defun format-encode-region (beg end &optional format) 344(defun format-encode-region (beg end &optional format)
345 "Translate the region into some FORMAT. 345 "Translate the region into some FORMAT.
346FORMAT defaults to `buffer-file-format', it is a symbol naming 346FORMAT defaults to `buffer-file-format'. It is a symbol naming
347one of the formats defined in `format-alist', or a list of such symbols." 347one of the formats defined in `format-alist', or a list of such symbols."
348 (interactive 348 (interactive
349 (list (region-beginning) (region-end) 349 (list (region-beginning) (region-end)
@@ -374,9 +374,9 @@ Make buffer visit that file and set the format as the default for future
374saves. If the buffer is already visiting a file, you can specify a directory 374saves. If the buffer is already visiting a file, you can specify a directory
375name as FILENAME, to write a file of the same old name in that directory. 375name as FILENAME, to write a file of the same old name in that directory.
376 376
377If optional third arg CONFIRM is non-nil, this function asks for 377If optional third arg CONFIRM is non-nil, ask for confirmation before
378confirmation before overwriting an existing file. Interactively, 378overwriting an existing file. Interactively, confirmation is required
379confirmation is required unless you supply a prefix argument." 379unless you supply a prefix argument."
380 (interactive 380 (interactive
381 ;; Same interactive spec as write-file, plus format question. 381 ;; Same interactive spec as write-file, plus format question.
382 (let* ((file (if buffer-file-name 382 (let* ((file (if buffer-file-name
@@ -419,7 +419,7 @@ If FORMAT is nil then do not do any format conversion."
419 "Insert the contents of file FILENAME using data format FORMAT. 419 "Insert the contents of file FILENAME using data format FORMAT.
420If FORMAT is nil then do not do any format conversion. 420If FORMAT is nil then do not do any format conversion.
421The optional third and fourth arguments BEG and END specify 421The optional third and fourth arguments BEG and END specify
422the part of the file to read. 422the part (in bytes) of the file to read.
423 423
424The return value is like the value of `insert-file-contents': 424The return value is like the value of `insert-file-contents':
425a list (ABSOLUTE-FILE-NAME SIZE)." 425a list (ABSOLUTE-FILE-NAME SIZE)."
@@ -456,10 +456,10 @@ Formats are defined in `format-alist'. Optional arg is the PROMPT to use."
456(defun format-replace-strings (alist &optional reverse beg end) 456(defun format-replace-strings (alist &optional reverse beg end)
457 "Do multiple replacements on the buffer. 457 "Do multiple replacements on the buffer.
458ALIST is a list of (FROM . TO) pairs, which should be proper arguments to 458ALIST is a list of (FROM . TO) pairs, which should be proper arguments to
459`search-forward' and `replace-match' respectively. 459`search-forward' and `replace-match', respectively.
460Optional 2nd arg REVERSE, if non-nil, means the pairs are (TO . FROM), so that 460Optional second arg REVERSE, if non-nil, means the pairs are (TO . FROM),
461you can use the same list in both directions if it contains only literal 461so that you can use the same list in both directions if it contains only
462strings. 462literal strings.
463Optional args BEG and END specify a region of the buffer on which to operate." 463Optional args BEG and END specify a region of the buffer on which to operate."
464 (save-excursion 464 (save-excursion
465 (save-restriction 465 (save-restriction
@@ -497,7 +497,7 @@ the value of `foo'."
497 497
498(defun format-make-relatively-unique (a b) 498(defun format-make-relatively-unique (a b)
499 "Delete common elements of lists A and B, return as pair. 499 "Delete common elements of lists A and B, return as pair.
500Compares using `equal'." 500Compare using `equal'."
501 (let* ((acopy (copy-sequence a)) 501 (let* ((acopy (copy-sequence a))
502 (bcopy (copy-sequence b)) 502 (bcopy (copy-sequence b))
503 (tail acopy)) 503 (tail acopy))
@@ -511,9 +511,9 @@ Compares using `equal'."
511 511
512(defun format-common-tail (a b) 512(defun format-common-tail (a b)
513 "Given two lists that have a common tail, return it. 513 "Given two lists that have a common tail, return it.
514Compares with `equal', and returns the part of A that is equal to the 514Compare with `equal', and return the part of A that is equal to the
515equivalent part of B. If even the last items of the two are not equal, 515equivalent part of B. If even the last items of the two are not equal,
516returns nil." 516return nil."
517 (let ((la (length a)) 517 (let ((la (length a))
518 (lb (length b))) 518 (lb (length b)))
519 ;; Make sure they are the same length 519 ;; Make sure they are the same length
@@ -534,9 +534,9 @@ A proper list is a list ending with a nil cdr, not with an atom "
534 (null list))) 534 (null list)))
535 535
536(defun format-reorder (items order) 536(defun format-reorder (items order)
537 "Arrange ITEMS to following partial ORDER. 537 "Arrange ITEMS to follow partial ORDER.
538Elements of ITEMS equal to elements of ORDER will be rearranged to follow the 538Elements of ITEMS equal to elements of ORDER will be rearranged
539ORDER. Unmatched items will go last." 539to follow the ORDER. Unmatched items will go last."
540 (if order 540 (if order
541 (let ((item (member (car order) items))) 541 (let ((item (member (car order) items)))
542 (if item 542 (if item
@@ -793,7 +793,7 @@ yet known.
793;; next-single-property-change instead of text-property-not-all, but then 793;; next-single-property-change instead of text-property-not-all, but then
794;; we have to see if we passed TO. 794;; we have to see if we passed TO.
795(defun format-property-increment-region (from to prop delta default) 795(defun format-property-increment-region (from to prop delta default)
796 "Over the region between FROM and TO increment property PROP by amount DELTA. 796 "In the region from FROM to TO increment property PROP by amount DELTA.
797DELTA may be negative. If property PROP is nil anywhere 797DELTA may be negative. If property PROP is nil anywhere
798in the region, it is treated as though it were DEFAULT." 798in the region, it is treated as though it were DEFAULT."
799 (let ((cur from) val newval next) 799 (let ((cur from) val newval next)
@@ -810,7 +810,7 @@ in the region, it is treated as though it were DEFAULT."
810 810
811(defun format-insert-annotations (list &optional offset) 811(defun format-insert-annotations (list &optional offset)
812 "Apply list of annotations to buffer as `write-region' would. 812 "Apply list of annotations to buffer as `write-region' would.
813Inserts each element of the given LIST of buffer annotations at its 813Insert each element of the given LIST of buffer annotations at its
814appropriate place. Use second arg OFFSET if the annotations' locations are 814appropriate place. Use second arg OFFSET if the annotations' locations are
815not relative to the beginning of the buffer: annotations will be inserted 815not relative to the beginning of the buffer: annotations will be inserted
816at their location-OFFSET+1 \(ie, the offset is treated as the position of 816at their location-OFFSET+1 \(ie, the offset is treated as the position of
@@ -834,7 +834,7 @@ property is the name of the annotation that you want to use, as it is for the
834 834
835(defun format-annotate-region (from to translations format-fn ignore) 835(defun format-annotate-region (from to translations format-fn ignore)
836 "Generate annotations for text properties in the region. 836 "Generate annotations for text properties in the region.
837Searches for changes between FROM and TO, and describes them with a list of 837Search for changes between FROM and TO, and describe them with a list of
838annotations as defined by alist TRANSLATIONS and FORMAT-FN. IGNORE lists text 838annotations as defined by alist TRANSLATIONS and FORMAT-FN. IGNORE lists text
839properties not to consider; any text properties that are neither ignored nor 839properties not to consider; any text properties that are neither ignored nor
840listed in TRANSLATIONS are warned about. 840listed in TRANSLATIONS are warned about.
@@ -975,9 +975,9 @@ either strings, or lists of the form (PARAMETER VALUE)."
975 "Return annotations for property PROP changing from OLD to NEW. 975 "Return annotations for property PROP changing from OLD to NEW.
976These are searched for in the translations alist TRANSLATIONS 976These are searched for in the translations alist TRANSLATIONS
977 (see `format-annotate-region' for the format). 977 (see `format-annotate-region' for the format).
978If NEW does not appear in the list, but there is a default function, then that 978If NEW does not appear in the list, but there is a default function,
979function is called. 979then call that function.
980Returns a cons of the form (CLOSE . OPEN) 980Return a cons of the form (CLOSE . OPEN)
981where CLOSE is a list of annotations to close 981where CLOSE is a list of annotations to close
982and OPEN is a list of annotations to open. 982and OPEN is a list of annotations to open.
983 983
@@ -1016,7 +1016,7 @@ either strings, or lists of the form (PARAMETER VALUE)."
1016 (format-annotate-atomic-property-change prop-alist old new))))) 1016 (format-annotate-atomic-property-change prop-alist old new)))))
1017 1017
1018(defun format-annotate-atomic-property-change (prop-alist old new) 1018(defun format-annotate-atomic-property-change (prop-alist old new)
1019 "Internal function annotate a single property change. 1019 "Internal function to annotate a single property change.
1020PROP-ALIST is the relevant element of a TRANSLATIONS list. 1020PROP-ALIST is the relevant element of a TRANSLATIONS list.
1021OLD and NEW are the values." 1021OLD and NEW are the values."
1022 (let (num-ann) 1022 (let (num-ann)