emacs-devel
[Top][All Lists]
Advanced

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

Re: Mysterious differences in nsselect.m


From: Stefan Monnier
Subject: Re: Mysterious differences in nsselect.m
Date: Tue, 21 Oct 2014 09:28:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

> 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



reply via email to

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