All Manuals > CAPI User Guide and Reference Manual > 21 CAPI Reference Entries

selection Function

Summary

Returns the primary selection.

Package

capi

Signature

selection self &optional format => result, emptyp

Arguments
self
A displayed CAPI pane or interface.
format
A keyword.
Values
result
A string, an image, a Lisp object, or nil.
emptyp
A boolean.
Description

The function selection returns the contents of the primary selection as a string, or nil if there is no selection. The second return value emptyp is true if the primary selection is empty and false otherwise.

format controls what kind of object is read. The following values of format are recognized:

:string
The object is a string. This is the default value.
:image
The object is of type image, converted from whatever format the platform supports.
:value
The object is the Lisp value.

When format is :image, the image returned by selection is associated with self, so you can free it explicitly with free-image or it will be freed automatically when the pane is destroyed.

On Microsoft Windows there is no notion of selection, so this mechanism is internal to Lisp.

Note that X applications may or may not use the primary selection for their paste operations. For instance, Emacs is configurable by the variable interprogram-paste-function.

See also

clipboard
free-image
image
selection-empty
set-selection
18.6 Clipboard


CAPI User Guide and Reference Manual (Windows version) - 18 Feb 2025 15:35:34