all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Yuri Khan <yuri.v.khan@gmail.com>
Cc: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>,
	Emacs developers <emacs-devel@gnu.org>
Subject: Re: Yanking as HTML
Date: Sun, 30 Oct 2016 12:18:18 +0100	[thread overview]
Message-ID: <m3eg2yqe4l.fsf@gnus.org> (raw)
In-Reply-To: <CAP_d_8XQqr9d=BT_gW80ZB=jdtx9D=UYofKLA4mVWzQb_Zy14w@mail.gmail.com> (Yuri Khan's message of "Sun, 30 Oct 2016 16:59:15 +0600")

Yuri Khan <yuri.v.khan@gmail.com> writes:

> On Sun, Oct 30, 2016 at 5:43 PM, Lars Ingebrigtsen <larsi@gnus.org> 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.

(gui-get-selection 'PRIMARY 'TARGETS)
=> [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)
=>
#("\377\376<div class=\"entry-meta\">
						<span class=\"meta-prep meta-prep-author\">BY</span> <span class=\"author vcard\"><a class=\"url fn n\" href=\"http://www.tcj.com/author/josselin-moneyron/\" title=\"View all posts by Josselin Moneyron\">Josselin Moneyron</a></span> <span class=\"entry-date\">Oct 27, 2016</span>					</div>" 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).

> 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.

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?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



  reply	other threads:[~2016-10-30 11:18 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-30  9:42 Yanking as HTML Lars Ingebrigtsen
2016-10-30  9:51 ` Andreas Schwab
2016-10-30 10:41   ` Lars Ingebrigtsen
2016-10-30 11:01     ` Andreas Schwab
2016-10-30 11:08       ` Lars Ingebrigtsen
2016-10-30 11:25         ` Stephen Berman
2016-10-30 17:17     ` Richard Stallman
2016-10-30 10:05 ` Daniel Colascione
2016-10-30 10:47   ` Lars Ingebrigtsen
2016-10-30 10:52     ` Daniel Colascione
2016-10-30 10:15 ` YAMAMOTO Mitsuharu
2016-10-30 10:43   ` Lars Ingebrigtsen
2016-10-30 10:59     ` Yuri Khan
2016-10-30 11:18       ` Lars Ingebrigtsen [this message]
2016-10-30 11:34         ` mituharu
2016-10-30 12:01           ` Lars Ingebrigtsen
2016-10-30 15:26             ` Lars Ingebrigtsen
2016-10-31 12:41             ` Ted Zlatanov
2016-10-31 13:21               ` Lars Ingebrigtsen
2016-10-31 15:48                 ` Eli Zaretskii
2016-11-03 23:55                   ` Chad Brown
2016-10-30 11:25       ` Lars Ingebrigtsen
2016-10-30 10:38 ` Igor Sosa Mayor
2016-11-04  7:13 ` Thierry Volpiatto
2016-11-04  8:49   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3eg2yqe4l.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=emacs-devel@gnu.org \
    --cc=mituharu@math.s.chiba-u.ac.jp \
    --cc=yuri.v.khan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.