From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Lars Ingebrigtsen Newsgroups: gmane.emacs.devel Subject: Re: Yanking as HTML Date: Sun, 30 Oct 2016 12:25:37 +0100 Message-ID: References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1477827390 4849 195.159.176.226 (30 Oct 2016 11:36:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 30 Oct 2016 11:36:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 30 12:36:23 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0oP6-0005iM-MW for ged-emacs-devel@m.gmane.org; Sun, 30 Oct 2016 12:35:56 +0100 Original-Received: from localhost ([::1]:57986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0oP9-0003uD-Ck for ged-emacs-devel@m.gmane.org; Sun, 30 Oct 2016 07:35:59 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0oHc-0006hD-EK for emacs-devel@gnu.org; Sun, 30 Oct 2016 07:28:16 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0oHb-0007OV-FF for emacs-devel@gnu.org; Sun, 30 Oct 2016 07:28:12 -0400 Original-Received: from hermes.netfonds.no ([80.91.224.195]:53661) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c0oHb-0007OG-92 for emacs-devel@gnu.org; Sun, 30 Oct 2016 07:28:11 -0400 Original-Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=stories) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1c0oHW-0001cC-LV for emacs-devel@gnu.org; Sun, 30 Oct 2016 12:28:10 +0100 In-Reply-To: (Yuri Khan's message of "Sun, 30 Oct 2016 16:59:15 +0600") Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAKlBMVEWtbDPCMoft+/zqhBL9 //65rJDgfhTmxODrgg76/v7DPYP80w7///+wmW6SZg6WAAACKElEQVQ4jZXUwWvTUBgA8EfBobaC OXjZSR8bkpGDEHADT4oXpYciPCMaQRSzXQQnhIJEKIzJuwgaegnkoseedul2KIKWhpLyFbZDh8P0 f/H73suaxLmDH+WRfr9+yfe+NGFwTrAP8/n8BOCQMXYFYK3X67lTXAL2ezAYvIThRSllpwk3DMP4 Nlk2vgasriDZQvgYKLg2wSVgAwVTSZEpWF4rwQ8FDfiCOeNpCd5K6Um5qaFXgidSMil34aeRh4Z1 +KWgA3f/ghS7nSNYiwpXwxi7FXh1twx3EBLcBEPMyoA7XNfdSnlpUoWD6zlsEhxp2MdhHTzO4RPB toY9guMcOg8xN9XwnWBpS74RLYT3mBtr6CP0l6SsqXnRmJpHCmrHnoc3iTVgiutlw7gabyuwwpvO O855DGmkgsOQvrKhcNpCWAneYZcWZ64iYH6bwp3iZDJaZhs7NobLnDMgNbQ1JAuwz4NShRBOBXZe MEbgA6xmlYoLQgDCIyHEzC9X2PYtBdSYKIAu8S+Q8gw0iq6qUPtcdEXgtHLYqxddBbQPrPCpKxXC VpHlO/fTus7vr9obZXDgmYZ+clqhpusHkGg4WYCvCwBalH8dJ69s+7bnZWzk4wybCOnzQzazYCxU BKz8CN8vP86nB8MuX+Hc5BTRCi/gHmVMk4dmGKp/CUBXAf065BanbBiGCE19Zh5GZkglXJm1OFX3 wShOzVEcRXGKn2alq8pL5r/hDwddQm+A1OUtAAAAAElFTkSuQmCC X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 80.91.224.195 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:208982 Archived-At: [Uhm, I sent a message with NUL characters that was apparently dropped by the GNU mail servers, so I'm resending. Apologies if this shows up twice.]=20 Yuri Khan writes: > On Sun, Oct 30, 2016 at 5:43 PM, Lars Ingebrigtsen wrote: > >> (gui-get-selection 'CLIPBOARD 'TARGETS) >> =3D> [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. (gui-get-selection 'PRIMARY 'TARGETS) =3D> [TIMESTAMP TARGETS MULTIPLE text/html text/_moz_htmlcontext text/_moz_= htmlinfo UTF8_STRING COMPOUND_TEXT TEXT STRING text/x-moz-url-priv] Oh, yeah, there it is. (x-get-selection-internal 'PRIMARY 'text/html) =3D> #("
BY Josse= lin Moneyron Oct 27, 2016 =
" 0 620 (foreign-selection STRING)) Fun! Apparently the support for doing this is in Emacs already, but it needs some tweaking (the selection is in utf-16 or something and needs decoding before usage?), so the main issue is really one of user interface and not the low-level support (that much). [And when I eval-ed this in Emacs, I got a NUL byte before each ASCII character, which seems to indicate UTF-16.] > 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 =E2=80=9C= what > you get=E2=80=9D in the target document differs from =E2=80=9Cwhat you se= e=E2=80=9D of the > source document. Well... People know that Emacs isn't a wysiwyg editor, so I don't think that is a complaint that will be common. The complaint will be 50% "why is it outputting all this HTML junk into my buffer?" and 50% "why isn't it outputting any HTML into my buffer?" :-) So creating a user interface that for this that annoys the least number of people is what's important. And it could even be a total opt-in thing, like a global minor mode like, er, `clever-yank-mode'. What about drag-and-drop? Is that basically the same as selections? If I were to drag an image from Firefox to this Message mode buffer, is it feasible to make that do something useful? --=20 (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no