Show
Ignore:
Timestamp:
08/10/06 11:19:54 (2 years ago)
Author:
miyoshi
Message:

Sync up with Emacs CVS HEAD.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lisp/format.el

    r4037 r4140  
    118118REGEXP  is a regular expression to match against the beginning of the file; 
    119119        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 
    121121        require explicit encoding/decoding. 
    122122 
    123 FROM-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 
    124124        and END, and can make any modifications it likes, returning the new 
    125125        end.  It must make sure that the beginning of the file no longer 
     
    128128        (including options) to be used as a filter to perform the conversion. 
    129129 
    130 TO-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 
    131131        arguments: BEGIN, END, and BUFFER.  BUFFER is the original buffer that 
    132132        the data being written came from, which the function could use, for 
     
    143143MODE-FN, if specified, is called when visiting a file with that format. 
    144144         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. 
    146146 
    147147PRESERVE, if non-nil, means that `format-write-file' should not remove 
     
    151151 
    152152(defun format-encode-run-method (method from to &optional buffer) 
    153   "Translate using function or shell script METHOD the text from FROM to TO. 
    154 If METHOD is a string, it is a shell command
     153  "Translate using METHOD the text from FROM to TO. 
     154If METHOD is a string, it is a shell command (including options)
    155155otherwise, it should be a Lisp function. 
    156156BUFFER should be the buffer that the output originally came from." 
     
    174174 
    175175(defun format-decode-run-method (method from to &optional buffer) 
    176   "Decode using function or shell script METHOD the text from FROM to TO. 
    177 If METHOD is a string, it is a shell command; otherwise, it should be 
    178 a Lisp function.  Decoding is done for the given BUFFER." 
     176  "Decode using METHOD the text from FROM to TO. 
     177If METHOD is a string, it is a shell command (including options); otherwise, 
     178it should be a Lisp function.  Decoding is done for the given BUFFER." 
    179179  (if (stringp method) 
    180180      (let ((error-buff (get-buffer-create "*Format Errors*")) 
     
    201201(defun format-annotate-function (format from to orig-buf format-count) 
    202202  "Return annotations for writing region as FORMAT. 
    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'. 
     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'. 
    205205FROM and TO delimit the region to be operated on in the current buffer. 
    206206ORIG-BUF is the original buffer that the data came from. 
     
    209209been called in the process of decoding ORIG-BUF. 
    210210 
    211 This function works like a function on `write-region-annotate-functions': 
     211This function works like a function in `write-region-annotate-functions': 
    212212it either returns a list of annotations, or returns with a different buffer 
    213213current, which contains the modified text to write.  In the latter case, 
     
    254254for those formats. 
    255255 
    256 Returns the new length of the decoded region. 
     256Return the new length of the decoded region. 
    257257 
    258258For most purposes, consider using `format-decode-region' instead." 
     
    313313(defun format-decode-buffer (&optional format) 
    314314  "Translate the buffer from some FORMAT. 
    315 If the format is not specified, this function attempts to guess. 
    316 `buffer-file-format' is set to the format used, and any mode-functions 
    317 for the format are called." 
     315If the format is not specified, attempt a regexp-based guess. 
     316Set `buffer-file-format' to the format used, and call any 
     317format-specific mode functions." 
    318318  (interactive 
    319319   (list (format-read "Translate buffer from format (default guess): "))) 
     
    344344(defun format-encode-region (beg end &optional format) 
    345345  "Translate the region into some FORMAT. 
    346 FORMAT defaults to `buffer-file-format', it is a symbol naming 
     346FORMAT defaults to `buffer-file-format'.  It is a symbol naming 
    347347one of the formats defined in `format-alist', or a list of such symbols." 
    348348  (interactive 
     
    375375name as FILENAME, to write a file of the same old name in that directory. 
    376376 
    377 If optional third arg CONFIRM is non-nil, this function asks for 
    378 confirmation before overwriting an existing file.  Interactively, 
    379 confirmation is required unless you supply a prefix argument." 
     377If optional third arg CONFIRM is non-nil, ask for confirmation before 
     378overwriting an existing file.  Interactively, confirmation is required 
     379unless you supply a prefix argument." 
    380380  (interactive 
    381381   ;; Same interactive spec as write-file, plus format question. 
     
    420420If FORMAT is nil then do not do any format conversion. 
    421421The optional third and fourth arguments BEG and END specify 
    422 the part of the file to read. 
     422the part (in bytes) of the file to read. 
    423423 
    424424The return value is like the value of `insert-file-contents': 
     
    457457  "Do multiple replacements on the buffer. 
    458458ALIST is a list of (FROM . TO) pairs, which should be proper arguments to 
    459 `search-forward' and `replace-match' respectively. 
    460 Optional 2nd arg REVERSE, if non-nil, means the pairs are (TO . FROM), so that 
    461 you can use the same list in both directions if it contains only literal 
    462 strings. 
     459`search-forward' and `replace-match', respectively. 
     460Optional second arg REVERSE, if non-nil, means the pairs are (TO . FROM), 
     461so that you can use the same list in both directions if it contains only 
     462literal strings. 
    463463Optional args BEG and END specify a region of the buffer on which to operate." 
    464464  (save-excursion 
     
    498498(defun format-make-relatively-unique (a b) 
    499499  "Delete common elements of lists A and B, return as pair. 
    500 Compares using `equal'." 
     500Compare using `equal'." 
    501501  (let* ((acopy (copy-sequence a)) 
    502502         (bcopy (copy-sequence b)) 
     
    512512(defun format-common-tail (a b) 
    513513  "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 
     514Compare with `equal', and return the part of A that is equal to the 
    515515equivalent part of B.  If even the last items of the two are not equal, 
    516 returns nil." 
     516return nil." 
    517517  (let ((la (length a)) 
    518518        (lb (length b))) 
     
    535535 
    536536(defun format-reorder (items order) 
    537   "Arrange ITEMS to following partial ORDER. 
    538 Elements of ITEMS equal to elements of ORDER will be rearranged to follow the 
    539 ORDER.  Unmatched items will go last." 
     537  "Arrange ITEMS to follow partial ORDER. 
     538Elements of ITEMS equal to elements of ORDER will be rearranged 
     539to follow the ORDER.  Unmatched items will go last." 
    540540  (if order 
    541541      (let ((item (member (car order) items))) 
     
    794794;; we have to see if we passed TO. 
    795795(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. 
    797797DELTA may be negative.  If property PROP is nil anywhere 
    798798in the region, it is treated as though it were DEFAULT." 
     
    811811(defun format-insert-annotations (list &optional offset) 
    812812  "Apply list of annotations to buffer as `write-region' would. 
    813 Inserts each element of the given LIST of buffer annotations at its 
     813Insert each element of the given LIST of buffer annotations at its 
    814814appropriate place.  Use second arg OFFSET if the annotations' locations are 
    815815not relative to the beginning of the buffer: annotations will be inserted 
     
    835835(defun format-annotate-region (from to translations format-fn ignore) 
    836836  "Generate annotations for text properties in the region. 
    837 Searches 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 
    838838annotations as defined by alist TRANSLATIONS and FORMAT-FN.  IGNORE lists text 
    839839properties not to consider; any text properties that are neither ignored nor 
     
    976976These are searched for in the translations alist TRANSLATIONS 
    977977 (see `format-annotate-region' for the format). 
    978 If NEW does not appear in the list, but there is a default function, then that 
    979 function is called
    980 Returns a cons of the form (CLOSE . OPEN) 
     978If NEW does not appear in the list, but there is a default function, 
     979then call that function
     980Return a cons of the form (CLOSE . OPEN) 
    981981where CLOSE is a list of annotations to close 
    982982and OPEN is a list of annotations to open. 
     
    10171017 
    10181018(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. 
    10201020PROP-ALIST is the relevant element of a TRANSLATIONS list. 
    10211021OLD and NEW are the values."