Function: secondary-selection-to-region

secondary-selection-to-region is a byte-compiled function defined in mouse.el.gz.

Signature

(secondary-selection-to-region)

Documentation

Set beginning and end of the region to those of the secondary selection.

This puts mark and point at the beginning and the end of the secondary selection, respectively. This works when the secondary selection exists and the region does not exist in current buffer; the secondary selection will be deleted afterward. If the region is active, or the secondary selection doesn't exist, this function does nothing.

Probably introduced at or before Emacs version 26.1.

Source Code

;; Defined in /usr/src/emacs/lisp/mouse.el.gz
(defun secondary-selection-to-region ()
  "Set beginning and end of the region to those of the secondary selection.
This puts mark and point at the beginning and the end of the
secondary selection, respectively.  This works when the secondary
selection exists and the region does not exist in current buffer;
the secondary selection will be deleted afterward.
If the region is active, or the secondary selection doesn't exist,
this function does nothing."
  (when (and (not (region-active-p))
             (secondary-selection-exist-p))
    (let ((beg (overlay-start mouse-secondary-overlay))
          (end (overlay-end mouse-secondary-overlay)))
      (push-mark beg t t)
      (goto-char end))
    ;; Delete the secondary selection on current buffer.
    (delete-overlay mouse-secondary-overlay)))