Functions in `write-region-annotate-functions' might make another buffer
the current one instead of returning a list of annotations. This is a
very useful behaviour, it could be mentioned in the docstring to make it
official. I could provide a first draft of the new docstring if you
want to make this behaviour official.
Looking at (fileio.c)build_annotations shows that behavior of functions
in `write-region-annotate-functions' is basically the same as the encode
functions in format-alist. For the encode functions, it is mentioned
that they could change the buffer contexts (see MODIFY in the docstring
of `format-alist').
- Christoph
P.S. in the alpha version of my package x-symbol, I use a function
safely in `write-region-annotate-functions' (since March) where
x-symbol-encode copies the contexts to the third arg, switches to that
buffer and does changes there...
(defun x-symbol-write-region-annotate-function (start end)
(and x-symbol-mode x-symbol-token-language
(let ((selective selective-display))
(when (x-symbol-encode x-symbol-safe-exec-threshold
(null x-symbol-file-has-8bits)
(get-buffer-create " x-symbol conversion "))
(setq selective-display selective)
t))
(message "X-Symbol Conversion in write-region%s" ; only alpha version
(if font-lock-mode " with font-lock" " (fast)")))
nil)