all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Drew Adams <drew.adams@oracle.com>, emacs-devel@gnu.org
Subject: Re: x-selection-exists-p  vs  x-get-selection
Date: Sun, 04 May 2008 15:34:22 +0900	[thread overview]
Message-ID: <wl4p9er30x.wl%mituharu@math.s.chiba-u.ac.jp> (raw)
In-Reply-To: <uiqxuwwbh.fsf@gnu.org>

>>>>> On Sun, 04 May 2008 07:02:42 +0300, Eli Zaretskii <eliz@gnu.org> 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
				mituharu@math.s.chiba-u.ac.jp




  reply	other threads:[~2008-05-04  6:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-03 22:54 x-selection-exists-p vs x-get-selection Drew Adams
2008-05-04  4:02 ` Eli Zaretskii
2008-05-04  6:34   ` YAMAMOTO Mitsuharu [this message]
2008-05-04 18:33     ` Eli Zaretskii
2008-05-04 20:43       ` Jason Rumney
2008-05-04 23:23         ` Drew Adams
2008-05-05  0:59       ` YAMAMOTO Mitsuharu
2008-05-04  8:33   ` Drew Adams
2008-05-04 18:29     ` Eli Zaretskii
2008-05-04 23:30       ` Drew Adams
2008-05-05  3:10         ` Eli Zaretskii

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=wl4p9er30x.wl%mituharu@math.s.chiba-u.ac.jp \
    --to=mituharu@math.s.chiba-u.ac.jp \
    --cc=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /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.