Next: , Previous: , Up: Frames   [Contents][Index]

30.23 Yanking Media

Data saved within window system selections is not restricted to plain text. It is possible for selection data to encompass images or other binary data of the like, as well as rich text content instanced by HTML, and also PostScript. Since the selection data types incident to this data are at variance with those for plain text, the insertion of such data is facilitated by a set of functions dubbed yank-media handlers, which are registered by each major mode undertaking its insertion and called where warranted upon the execution of the yank-media command.

Function: yank-media-handler types handler

Register a yank-media handler which applies to the current buffer.

types can be a symbol designating a selection data type (see Accessing Selections), a regexp against which such types are matched, or a list of these symbols and regexps. For instance:

(yank-media-handler 'text/html #'my-html-handler)
(yank-media-handler "image/.*" #'my-image-handler)

When a selection offers a data type matching types, the function handler is called to insert its data, with the symbol designating the matching selection data type, and the data returned by gui-get-selection.

The yank-media-types command presents a list of selection data types that are currently available, which is useful when implementing yank-media handlers; for programs generally offer an eclectic and seldom consistent medley of data types.