all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: "Jan Djärv" <jan.h.d@swipnet.se>
Cc: Adrian Robert <Adrian.B.Robert@gmail.com>, emacs-devel@gnu.org
Subject: Re: Mysterious differences in nsselect.m
Date: Tue, 21 Oct 2014 09:28:25 -0400	[thread overview]
Message-ID: <jwv38ahlg2f.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <2B06B631-0098-48DF-9307-CD8A328E972F@swipnet.se> ("Jan Djärv"'s message of "Sun, 19 Oct 2014 10:13:44 +0200")

> If you examine this, you see that "all selection types", i.e. ns_send_types
> is an array with one member, NSStringPboardType.  So both cases are in
> practice the same.

Aha!

> But for now Emacs only set strings.

Good enough for me.

>> FWIW, I don't know what it means to set a pasteboard for a particular
>> selection type, nor to set it for all selection types.
> Its typed data.  You tell the the pasteboard what data to expect,
> i.e. NSStringPboardType, NSFilenamesPboardType, NSURLPboardType and
> so on.

What I mean is: if you push to the clipboard a string "hello" and then
a filename "/a/b", are they still both in there, or does the second
replace the first?

If the second replaces the first then the loop in
ns_string_to_pasteboard_internal makes no sense, but if they both stay
in there, then it basically means we have several clipboards, so we may
miss one application's clipboard data simply because we don't request
the right type.

> It seems that ns-own-selection-internal is the way it is to go together with
> ns-disown-selection-internal and ns-selection-owner-p.

Indeed.

> Disown and owner-p does not really exist on NS, you just set data and
> that is it.  own stores data in Vselection_alist so that disown and
> owner-p can emulate the X versions.  Some experimentation shows that
> owner-p does not work well.

IIUC the only place we use owner-p is for some corner case of
select-active-region (hence only with the PRIMARY, not with CLIPBOARD),
so it's probably not super important.

> What parts of Emacs use owner-p?

IIRC the only existing call is in deactivate-mark.

Adrian Robert wrote:
> Just to add something about the history that may or may not be informative,
> the "-store-selection-internal" version was originally part of a whole suite
> of functions pertaining to “cut buffers”, which appear to be an older
> X implementation of selection that emacs supported for a while.  I wanted to
> refactor them out a while back but could not figure out how to do it
> cleanly.  Only ns-store-selection-internal and ns-get-selection-internal
> remain now.  If Emacs itself still has multiple selection implementations
> for X, then we need to keep these for parallelism, but if the older code is
> finally gone I would think this could be cleaned up too.

Thanks.  I'm about to install a patch that will remove
ns-store-selection-internal and ns-get-selection-internal and use
ns-own-selection and ns-get-selection instead.  This may break some
things (while ns-own-selection and ns-get-selection seem to be the more
"complex/fancy/complete" implementation, they're also the one that's
been less used since kill/yank has used ns-store-selection-internal and
ns-get-selection-internal until now), tho.


        Stefan



  parent reply	other threads:[~2014-10-21 13:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-18 22:16 Mysterious differences in nsselect.m Stefan Monnier
2014-10-19  8:13 ` Jan Djärv
2014-10-19  9:59   ` Adrian Robert
2014-10-21 13:28   ` Stefan Monnier [this message]
2014-10-21 19:01     ` Jan Djärv

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=jwv38ahlg2f.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=Adrian.B.Robert@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=jan.h.d@swipnet.se \
    /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.