aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2009-01-22 04:53:41 +0000
committerChong Yidong2009-01-22 04:53:41 +0000
commitae12425c9d1bb813a2c58ec94cb835b76c18fb6a (patch)
treea03e7d89795e173ca37950a31c41b3799a9e87d9
parente3aa6669faf38d4b20ddbdb6b5777e68817a6f18 (diff)
downloademacs-ae12425c9d1bb813a2c58ec94cb835b76c18fb6a.tar.gz
emacs-ae12425c9d1bb813a2c58ec94cb835b76c18fb6a.zip
(Format Conversion Piecemeal): Clarify behavior of
write-region-annotate-functions. Document write-region-post-annotation-function.
-rw-r--r--doc/lispref/files.texi52
1 files changed, 34 insertions, 18 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 17d439725d5..8d02831a7fb 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -3070,18 +3070,17 @@ place without modifying the buffer.
3070@c ??? for `write-region-annotate-functions', below? --ttn 3070@c ??? for `write-region-annotate-functions', below? --ttn
3071 3071
3072 In contrast, when reading, the annotations intermixed with the text 3072 In contrast, when reading, the annotations intermixed with the text
3073are handled immediately. @code{insert-file-contents} sets point to the 3073are handled immediately. @code{insert-file-contents} sets point to
3074beginning of some text to be converted, then calls the conversion 3074the beginning of some text to be converted, then calls the conversion
3075functions with the length of that text. These functions should always 3075functions with the length of that text. These functions should always
3076return with point at the beginning of the inserted text. This approach 3076return with point at the beginning of the inserted text. This
3077makes sense for reading because annotations removed by the first 3077approach makes sense for reading because annotations removed by the
3078converter can't be mistakenly processed by a later converter. 3078first converter can't be mistakenly processed by a later converter.
3079 3079Each conversion function should scan for the annotations it
3080 Each conversion function should scan for the annotations it 3080recognizes, remove the annotation, modify the buffer text (to set a
3081recognizes, remove the annotation, modify the buffer text (to set a text 3081text property, for example), and return the updated length of the
3082property, for example), and return the updated length of the text, as it 3082text, as it stands after those changes. The value returned by one
3083stands after those changes. The value returned by one function becomes 3083function becomes the argument to the next function.
3084the argument to the next function.
3085 3084
3086@defvar write-region-annotate-functions 3085@defvar write-region-annotate-functions
3087A list of functions for @code{write-region} to call. Each function in 3086A list of functions for @code{write-region} to call. Each function in
@@ -3089,13 +3088,30 @@ the list is called with two arguments: the start and end of the region
3089to be written. These functions should not alter the contents of the 3088to be written. These functions should not alter the contents of the
3090buffer. Instead, they should return annotations. 3089buffer. Instead, they should return annotations.
3091 3090
3092@c ??? Following adapted from comment in `build_annotations' (fileio.c). 3091As a special case, a function may return with a different buffer
3093@c ??? Perhaps this is intended for internal use only? 3092current. Emacs takes this to mean that the current buffer contains
3094@c ??? Someone who understands this, please reword it. --ttn 3093altered text to be output. It therefore changes the @var{start} and
3095As a special case, if a function returns with a different buffer 3094@var{end} arguments of the @code{write-region} call, giving them the
3096current, Emacs takes it to mean the current buffer contains altered text 3095values of @code{point-min} and @code{point-max} in the new buffer,
3097to be output, and discards all previous annotations because they should 3096respectively. It also discards all previous annotations, because they
3098have been dealt with by this function. 3097should have been dealt with by this function.
3098@end defvar
3099
3100@defvar write-region-post-annotation-function
3101The value of this variable, if non-@code{nil}, should be a function.
3102This function is called, with no arguments, after @code{write-region}
3103has completed.
3104
3105If any function in @code{write-region-annotate-functions} returns with
3106a different buffer current, Emacs calls
3107@code{write-region-post-annotation-function} more than once. Emacs
3108calls it with the last buffer that was current, and again with the
3109buffer before that, and so on back to the original buffer.
3110
3111Thus, a function in @code{write-region-annotate-functions} can create
3112a buffer, give this variable the local value of @code{kill-buffer} in
3113that buffer, set up the buffer with altered text, and make the buffer
3114current. The buffer will be killed after @code{write-region} is done.
3099@end defvar 3115@end defvar
3100 3116
3101@defvar after-insert-file-functions 3117@defvar after-insert-file-functions