Except for html-mode buffers, buffer contents will be run through a user-defined filter. The default user filter is htmlize, but you can set your own with imp-set-user-filter. The user filter is nothing but a regular elisp function. Here's how you would define a basic filter:
The original editing buffer is passed along the user filter as a parameter, which we didn't use in the previous example, but which is demonstrated in the following example:
But imp-htmlize-filter do insert filtered contents.
Since the user is unlikely to notice that the current buffer has
changed due to a side effect, I am concerned that INSERT will
rewrite the current buffer.
Like the function in README, the filter function outputs a string
by princ and I think it would be better to capture it by changing
the standard-output.
README says filter function should use
princ
.But
imp-htmlize-filter
doinsert
filtered contents.Since the user is unlikely to notice that the current buffer has changed due to a side effect, I am concerned that INSERT will rewrite the current buffer.
Like the function in README, the filter function outputs a string by
princ
and I think it would be better to capture it by changing thestandard-output
.