Mercurial > hg > xemacs-beta
comparison lisp/prim/format.el @ 203:850242ba4a81 r20-3b28
Import from CVS: tag r20-3b28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:02:21 +0200 |
parents | 85ec50267440 |
children |
comparison
equal
deleted
inserted
replaced
202:61eefc8fc970 | 203:850242ba4a81 |
---|---|
108 annotations. | 108 annotations. |
109 MODE-FN, if specified, is called when visiting a file with that format.") | 109 MODE-FN, if specified, is called when visiting a file with that format.") |
110 | 110 |
111 ;;; Basic Functions (called from Lisp) | 111 ;;; Basic Functions (called from Lisp) |
112 | 112 |
113 (defun format-annotate-function (format from to orig-buf) | 113 (defun format-annotate-function (format from to) |
114 "Returns annotations for writing region as FORMAT. | 114 "Returns annotations for writing region as FORMAT. |
115 FORMAT is a symbol naming one of the formats defined in `format-alist', | 115 FORMAT is a symbol naming one of the formats defined in `format-alist', |
116 it must be a single symbol, not a list like `buffer-file-format'. | 116 it must be a single symbol, not a list like `buffer-file-format'. |
117 FROM and TO delimit the region to be operated on in the current buffer. | 117 FROM and TO delimit the region to be operated on in the current buffer. |
118 ORIG-BUF is the original buffer that the data came from. | |
119 This function works like a function on `write-region-annotate-functions': | 118 This function works like a function on `write-region-annotate-functions': |
120 it either returns a list of annotations, or returns with a different buffer | 119 it either returns a list of annotations, or returns with a different buffer |
121 current, which contains the modified text to write. | 120 current, which contains the modified text to write. |
122 | 121 |
123 For most purposes, consider using `format-encode-region' instead." | 122 For most purposes, consider using `format-encode-region' instead." |
131 ;; To-function wants to modify region. Copy to safe place. | 130 ;; To-function wants to modify region. Copy to safe place. |
132 (let ((copy-buf (get-buffer-create " *Format Temp*"))) | 131 (let ((copy-buf (get-buffer-create " *Format Temp*"))) |
133 (copy-to-buffer copy-buf from to) | 132 (copy-to-buffer copy-buf from to) |
134 (set-buffer copy-buf) | 133 (set-buffer copy-buf) |
135 (format-insert-annotations write-region-annotations-so-far from) | 134 (format-insert-annotations write-region-annotations-so-far from) |
136 (funcall to-fn (point-min) (point-max) orig-buf) | 135 (funcall to-fn (point-min) (point-max)) |
137 nil) | 136 nil) |
138 ;; Otherwise just call function, it will return annotations. | 137 ;; Otherwise just call function, it will return annotations. |
139 (funcall to-fn from to orig-buf))))) | 138 (funcall to-fn from to))))) |
140 | 139 |
141 (defun format-decode (format length &optional visit-flag) | 140 (defun format-decode (format length &optional visit-flag) |
142 ;; This function is called by insert-file-contents whenever a file is read. | 141 ;; This function is called by insert-file-contents whenever a file is read. |
143 "Decode text from any known FORMAT. | 142 "Decode text from any known FORMAT. |
144 FORMAT is a symbol appearing in `format-alist' or a list of such symbols, | 143 FORMAT is a symbol appearing in `format-alist' or a list of such symbols, |