emacs-devel
[Top][All Lists]
Advanced

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

Re: x-selection-exists-p vs x-get-selection


From: YAMAMOTO Mitsuharu
Subject: Re: x-selection-exists-p vs x-get-selection
Date: Sun, 04 May 2008 15:34:22 +0900
User-agent: Wanderlust/2.14.0 (Africa) SEMI/1.14.6 (Maruoka) FLIM/1.14.8 (Shijō) APEL/10.6 Emacs/23.0.50 (sparc-sun-solaris2.8) MULE/5.0 (SAKAKI)

>>>>> On Sun, 04 May 2008 07:02:42 +0300, Eli Zaretskii <address@hidden> said:

>> How should I understand `x-selection-exists-p'? It is used, for
>> instance, in menu-bar.el, to determine whether to enable some
>> selection menus, such as Paste.

> These functions make sense only on X window systems.  Their
> functionality on Windows is tuned to make their callers DTRT, but
> that's all; there's no underlying theory that would make sense on
> Windows besides that.  There are no ``selections'' on Windows, and
> no ``owners'' of selections.  If you want to understand these
> functions' semantics on X, read some X manual.

FWIW, macselect.c for the Mac Carbon port is trying to simulate the
semantics on X11 by reusing the most of the code in xselect.c.  On
Mac, there are multiple interapplication storages called "scrap"s, and
the clipboard is actually a particular scrap named
"com.apple.scrap.clipboard".  The selection such as PRIMARY or
SECONDARY may or may not be associated with a scrap.  The association
is made via mac-scrap-name property.

  lisp/term/mac-win.el:

    (put 'CLIPBOARD 'mac-scrap-name "com.apple.scrap.clipboard")
    (when (eq system-type 'darwin)
      (put 'FIND 'mac-scrap-name "com.apple.scrap.find")
      (put 'PRIMARY 'mac-scrap-name
           (format "org.gnu.Emacs.%d.selection.PRIMARY" (emacs-pid))))

The selection SECONDARY is not associated with any scraps.

The scrap associated with a selection works as a backing store of the
selection.  When Emacs owns such a selection, the data is stored to
the scrap.  When another application set some data to the scrap, Emacs
can retrieve it through the corresponding selection.

A selection that is not associated with any scraps is used inside
Emacs only.  Still one can "own" such a selection.

                                     YAMAMOTO Mitsuharu
                                address@hidden




reply via email to

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