> 2. Defining two new abnormal hooks, maybe named yank-encode-functions and > kill-encode-functions, to be called by kill-region etc (or possibly the > lower-level functions like kill-new and kill-append.) Each function would > be called with one argument, the yanked or killed string, and return an > encoded string to be passed to the next function, or to the buffer/kill > ring.
On further consideration, there seems to be some overlap between the above suggestion and the yank-handler text property (new to Emacs 22). It may be better to a variable called `yank-handlers' which is a list of yank handlers to use. The yank functions could then read from both yank-handlers and the yank-handler text property. There is one problem, however: currently, the function specified by the yank-handler text property is called *instead* of insert, to insert the desired text. According to NEWS, this is to allow it to do things like yanking rectanges. Such a function obviously cannot "stack", so what happens if yank-handlers and the yank-handler text property are both defined? My original idea was to have the functions specified by yank-handlers return a string to be passed to the next handler, but (i) this would be an incompatibility with the text property, and (ii) it won't be able to perform more general operations like yanking rectangles. I would also still need an analogous kill-handlers variable for encoding kills, i.e. stripping out newlines from the killed text (it's not enough to use a yank handler, because the killed text could be pasted into an external program via the X selection or clipboard.) _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel