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

clipboard Function

Summary

Returns the contents of the system clipboard.

Package

capi

Signature

clipboard 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 clipboard returns the contents of the system clipboard as a string, or nil if the clipboard is empty. The second return value emptyp is true if the clipboard 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.
:metafile
The object is a metafile.

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

When format is :metafile the object is a metafile which should be freed using free-metafile when no longer needed. See also draw-metafile and draw-metafile-to-image. format :metafile is not supported on GTK+ or X11/Motif.

The Microsoft Windows clipboard is usually set by the user with the Ctrl+C and Ctrl+X gestures. Note that the LispWorks editor uses these gestures when in Windows emulation mode.

On X11/Motif, various gestures may set the clipboard. Note that LispWorks uses Ctrl+C and Ctrl+X when in KDE/Gnome editor emulation mode. The X clipboard can also be accessed by running the program xclipboard or the Emacs function x-get-clipboard.

The macOS clipboard is usually set by the user with the Command+C and Command+X gestures.

See also

clipboard-empty
draw-metafile
draw-metafile-to-image
free-image
free-metafile
image
selection
set-clipboard
text-input-pane-paste
18.6 Clipboard


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