emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Yanking as HTML


From: Yuri Khan
Subject: Re: Yanking as HTML
Date: Sun, 30 Oct 2016 16:59:15 +0600

On Sun, Oct 30, 2016 at 5:43 PM, Lars Ingebrigtsen <address@hidden> wrote:

> (gui-get-selection 'CLIPBOARD 'TARGETS)
> => [TIMESTAMP TARGETS MULTIPLE SAVE_TARGETS UTF8_STRING COMPOUND_TEXT TEXT 
> STRING]
>
> Hm...  so it lacks the "text/html" target that xclip -o -t TARGETS
> lists?

Your xclip invocation targets the PRIMARY selection (by default) while
the elisp snippet examines CLIPBOARD. This might be a reason for the
difference you observe.

In my test, text/html was present and I was able to see it as an Emacs
propertized string containing HTML tags.

Note that, in general, it is impossible to correctly copy-paste styled
HTML between documents:

* If you paste only the HTML, half the users will complain that “what
you get” in the target document differs from “what you see” of the
source document.

* If you paste both the HTML and CSS of the source, you introduce a
non-local effect (HTML is pasted at point while CSS needs to be pasted
at a different location).

* In a misguided attempt to sidestep the issue above, some programs
parse the HTML and CSS and apply CSS as direct formatting (HTML
style="" attribute). At this point, the other half of the users
(myself included) will complain that direct formatting is evil and any
tool that produces such where there was none is broken.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]