diff options
| author | Thien-Thi Nguyen | 2006-08-02 22:51:44 +0000 |
|---|---|---|
| committer | Thien-Thi Nguyen | 2006-08-02 22:51:44 +0000 |
| commit | 1200843820a76d33eeb0386cd617feec55a247f0 (patch) | |
| tree | 0a248e70551ff76e45e8f239317e890bcfc8d667 | |
| parent | d2f00838a139465c7d0d49fe83eee36902943f13 (diff) | |
| download | emacs-1200843820a76d33eeb0386cd617feec55a247f0.tar.gz emacs-1200843820a76d33eeb0386cd617feec55a247f0.zip | |
Docstring style and grammar tweaks; nfc.
| -rw-r--r-- | lisp/format.el | 76 |
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 | ||
| 118 | REGEXP is a regular expression to match against the beginning of the file; | 118 | REGEXP 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 | ||
| 123 | FROM-FN is called to decode files in that format; it gets two args, BEGIN | 123 | FROM-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 | ||
| 130 | TO-FN is called to encode a region into that format; it is passed three | 130 | TO-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 | ||
| 143 | MODE-FN, if specified, is called when visiting a file with that format. | 143 | MODE-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 | ||
| 147 | PRESERVE, if non-nil, means that `format-write-file' should not remove | 147 | PRESERVE, 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. |
| 154 | If METHOD is a string, it is a shell command; | 154 | If METHOD is a string, it is a shell command (including options); |
| 155 | otherwise, it should be a Lisp function. | 155 | otherwise, it should be a Lisp function. |
| 156 | BUFFER should be the buffer that the output originally came from." | 156 | BUFFER 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. |
| 177 | If METHOD is a string, it is a shell command; otherwise, it should be | 177 | If METHOD is a string, it is a shell command (including options); otherwise, |
| 178 | a Lisp function. Decoding is done for the given BUFFER." | 178 | it 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. |
| 203 | FORMAT is a symbol naming one of the formats defined in `format-alist', | 203 | FORMAT is a symbol naming one of the formats defined in `format-alist'. |
| 204 | it must be a single symbol, not a list like `buffer-file-format'. | 204 | It must be a single symbol, not a list like `buffer-file-format'. |
| 205 | FROM and TO delimit the region to be operated on in the current buffer. | 205 | FROM and TO delimit the region to be operated on in the current buffer. |
| 206 | ORIG-BUF is the original buffer that the data came from. | 206 | ORIG-BUF is the original buffer that the data came from. |
| 207 | 207 | ||
| 208 | FORMAT-COUNT is an integer specifying how many times this function has | 208 | FORMAT-COUNT is an integer specifying how many times this function has |
| 209 | been called in the process of decoding ORIG-BUF. | 209 | been called in the process of decoding ORIG-BUF. |
| 210 | 210 | ||
| 211 | This function works like a function on `write-region-annotate-functions': | 211 | This function works like a function in `write-region-annotate-functions': |
| 212 | it either returns a list of annotations, or returns with a different buffer | 212 | it either returns a list of annotations, or returns with a different buffer |
| 213 | current, which contains the modified text to write. In the latter case, | 213 | current, which contains the modified text to write. In the latter case, |
| 214 | this function's value is nil. | 214 | this function's value is nil. |
| @@ -253,7 +253,7 @@ If optional third arg VISIT-FLAG is true, set `buffer-file-format' | |||
| 253 | to the reverted list of formats used, and call any mode functions defined | 253 | to the reverted list of formats used, and call any mode functions defined |
| 254 | for those formats. | 254 | for those formats. |
| 255 | 255 | ||
| 256 | Returns the new length of the decoded region. | 256 | Return the new length of the decoded region. |
| 257 | 257 | ||
| 258 | For most purposes, consider using `format-decode-region' instead." | 258 | For 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. |
| 315 | If the format is not specified, this function attempts to guess. | 315 | If the format is not specified, attempt a regexp-based guess. |
| 316 | `buffer-file-format' is set to the format used, and any mode-functions | 316 | Set `buffer-file-format' to the format used, and call any |
| 317 | for the format are called." | 317 | format-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. |
| 346 | FORMAT defaults to `buffer-file-format', it is a symbol naming | 346 | FORMAT defaults to `buffer-file-format'. It is a symbol naming |
| 347 | one of the formats defined in `format-alist', or a list of such symbols." | 347 | one 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 | |||
| 374 | saves. If the buffer is already visiting a file, you can specify a directory | 374 | saves. If the buffer is already visiting a file, you can specify a directory |
| 375 | name as FILENAME, to write a file of the same old name in that directory. | 375 | name as FILENAME, to write a file of the same old name in that directory. |
| 376 | 376 | ||
| 377 | If optional third arg CONFIRM is non-nil, this function asks for | 377 | If optional third arg CONFIRM is non-nil, ask for confirmation before |
| 378 | confirmation before overwriting an existing file. Interactively, | 378 | overwriting an existing file. Interactively, confirmation is required |
| 379 | confirmation is required unless you supply a prefix argument." | 379 | unless 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. |
| 420 | If FORMAT is nil then do not do any format conversion. | 420 | If FORMAT is nil then do not do any format conversion. |
| 421 | The optional third and fourth arguments BEG and END specify | 421 | The optional third and fourth arguments BEG and END specify |
| 422 | the part of the file to read. | 422 | the part (in bytes) of the file to read. |
| 423 | 423 | ||
| 424 | The return value is like the value of `insert-file-contents': | 424 | The return value is like the value of `insert-file-contents': |
| 425 | a list (ABSOLUTE-FILE-NAME SIZE)." | 425 | a 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. |
| 458 | ALIST is a list of (FROM . TO) pairs, which should be proper arguments to | 458 | ALIST 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. |
| 460 | Optional 2nd arg REVERSE, if non-nil, means the pairs are (TO . FROM), so that | 460 | Optional second arg REVERSE, if non-nil, means the pairs are (TO . FROM), |
| 461 | you can use the same list in both directions if it contains only literal | 461 | so that you can use the same list in both directions if it contains only |
| 462 | strings. | 462 | literal strings. |
| 463 | Optional args BEG and END specify a region of the buffer on which to operate." | 463 | Optional 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. |
| 500 | Compares using `equal'." | 500 | Compare 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. |
| 514 | Compares with `equal', and returns the part of A that is equal to the | 514 | Compare with `equal', and return the part of A that is equal to the |
| 515 | equivalent part of B. If even the last items of the two are not equal, | 515 | equivalent part of B. If even the last items of the two are not equal, |
| 516 | returns nil." | 516 | return 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. |
| 538 | Elements of ITEMS equal to elements of ORDER will be rearranged to follow the | 538 | Elements of ITEMS equal to elements of ORDER will be rearranged |
| 539 | ORDER. Unmatched items will go last." | 539 | to 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. |
| 797 | DELTA may be negative. If property PROP is nil anywhere | 797 | DELTA may be negative. If property PROP is nil anywhere |
| 798 | in the region, it is treated as though it were DEFAULT." | 798 | in 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. |
| 813 | Inserts each element of the given LIST of buffer annotations at its | 813 | Insert each element of the given LIST of buffer annotations at its |
| 814 | appropriate place. Use second arg OFFSET if the annotations' locations are | 814 | appropriate place. Use second arg OFFSET if the annotations' locations are |
| 815 | not relative to the beginning of the buffer: annotations will be inserted | 815 | not relative to the beginning of the buffer: annotations will be inserted |
| 816 | at their location-OFFSET+1 \(ie, the offset is treated as the position of | 816 | at 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. |
| 837 | Searches for changes between FROM and TO, and describes them with a list of | 837 | Search for changes between FROM and TO, and describe them with a list of |
| 838 | annotations as defined by alist TRANSLATIONS and FORMAT-FN. IGNORE lists text | 838 | annotations as defined by alist TRANSLATIONS and FORMAT-FN. IGNORE lists text |
| 839 | properties not to consider; any text properties that are neither ignored nor | 839 | properties not to consider; any text properties that are neither ignored nor |
| 840 | listed in TRANSLATIONS are warned about. | 840 | listed 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. |
| 976 | These are searched for in the translations alist TRANSLATIONS | 976 | These are searched for in the translations alist TRANSLATIONS |
| 977 | (see `format-annotate-region' for the format). | 977 | (see `format-annotate-region' for the format). |
| 978 | If NEW does not appear in the list, but there is a default function, then that | 978 | If NEW does not appear in the list, but there is a default function, |
| 979 | function is called. | 979 | then call that function. |
| 980 | Returns a cons of the form (CLOSE . OPEN) | 980 | Return a cons of the form (CLOSE . OPEN) |
| 981 | where CLOSE is a list of annotations to close | 981 | where CLOSE is a list of annotations to close |
| 982 | and OPEN is a list of annotations to open. | 982 | and 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. |
| 1020 | PROP-ALIST is the relevant element of a TRANSLATIONS list. | 1020 | PROP-ALIST is the relevant element of a TRANSLATIONS list. |
| 1021 | OLD and NEW are the values." | 1021 | OLD and NEW are the values." |
| 1022 | (let (num-ann) | 1022 | (let (num-ann) |