Reading <
http://www.jwz.org/doc/x-cut-and-paste.html> inspired me to
think about integrating `htmlize' with the primary selections XEmacs
exports to other applications. Jamie says:
But when pasting [the primary selection] into a word processor,
you'd want to keep the font information: if both applications
spoke HTML, they could use that as the intermediate format by
which they transferred the data.
Jamie, have you seen `htmlize'? It's at
http://fly.srk.fer.hr/~hniksic/emacs/htmlize.el, and it allows easy
conversion of buffer contents to HTML. Sort of like
`ps-print-buffer-with-faces', but with HTML output.
What I'd like to do is have XEmacs call htmlize code when exporting
primary selection to applications that can handle HTML. Your article
implies that the XEmacs selection mechanism is powerful enough to
negotiate content types with the recipients.
The content negotiation mechansim is very powerful, and I wish
more applications would take advantage of it.
For examples of how to use it, see the files select.el and/or
x-select.el from any XEmacs distribution. There are some utility
functions in there that will let you experiment with content
negotiation with other apps, see what types the apps are capable
of converting to, etc. For example:
(x-get-selection-internal 'PRIMARY 'TARGETS)
==> [TARGETS TIMESTAMP TEXT STRING LENGTH FILE_NAME OWNER_OS
HOST_NAME USER CLASS NAME CLIENT_WINDOW PROCESS COMPOUND_TEXT]
(x-get-selection-internal 'PRIMARY 'FILE_NAME)
==> "http://www.jwz.org/doc/x-cut-and-paste.html"
On my XEmacs 21.4.13, `x-get-selection-internal' doesn't exist and
`get-selection-internal' seems to always returns nil, regardless of
the application that owns the primary selection.
Looking at select.el doesn't provide many clue how to export HTML. It
does deal with selection "types", but I don't see anything resembling
a MIME-like content-type that I could check for html. select-x.c is
similarly unhelpful. The only place in XEmacs that handles MIME-like
content types is the (broken) drag-n-drop code.