Function: gui-select-text

gui-select-text is a byte-compiled function defined in select.el.gz.

Signature

(gui-select-text TEXT)

Documentation

Select TEXT, a string, according to the window system.

If select-enable-clipboard is non-nil, copy TEXT to the system's clipboard. If select-enable-primary is non-nil, put TEXT in the primary selection.

MS-Windows does not have a "primary" selection.

Probably introduced at or before Emacs version 25.1.

Aliases

x-select-text (obsolete since 25.1)

Source Code

;; Defined in /usr/src/emacs/lisp/select.el.gz
(defun gui-select-text (text)
  "Select TEXT, a string, according to the window system.
If `select-enable-clipboard' is non-nil, copy TEXT to the system's clipboard.
If `select-enable-primary' is non-nil, put TEXT in the primary selection.

MS-Windows does not have a \"primary\" selection."
  (when select-enable-primary
    (gui-set-selection 'PRIMARY text)
    (gui--set-last-primary-selection text))
  (when select-enable-clipboard
    ;; When cutting, the selection is cleared and PRIMARY
    ;; set to the empty string.  Prevent that, PRIMARY
    ;; should not be reset by cut (Bug#16382).
    (setq saved-region-selection text)
    (gui-set-selection 'CLIPBOARD text)
    (gui--set-last-clipboard-selection text))
  ;; Record which selections we now have ownership over.
  (setq gui-last-cut-in-clipboard select-enable-clipboard
        gui-last-cut-in-primary select-enable-primary))