Function: mouse-kill-secondary

mouse-kill-secondary is an interactive and byte-compiled function defined in mouse.el.gz.

Signature

(mouse-kill-secondary)

Documentation

Kill the text in the secondary selection.

This is intended more as a keyboard command than as a mouse command but it can work as either one.

The current buffer (in case of keyboard use), or the buffer clicked on, must be the one that the secondary selection is in. This requirement is to prevent accidents.

Probably introduced at or before Emacs version 19.23.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mouse.el.gz
(defun mouse-kill-secondary ()
  "Kill the text in the secondary selection.
This is intended more as a keyboard command than as a mouse command
but it can work as either one.

The current buffer (in case of keyboard use), or the buffer clicked on,
must be the one that the secondary selection is in.  This requirement
is to prevent accidents."
  (interactive)
  (let* ((keys (this-command-keys))
	 (click (elt keys (1- (length keys)))))
    (or (eq (overlay-buffer mouse-secondary-overlay)
	    (if (listp click)
		(window-buffer (posn-window (event-start click)))
	      (current-buffer)))
	(error "Select or click on the buffer where the secondary selection is")))
  (let (this-command)
    (with-current-buffer (overlay-buffer mouse-secondary-overlay)
      (kill-region (overlay-start mouse-secondary-overlay)
		   (overlay-end mouse-secondary-overlay))))
  (delete-overlay mouse-secondary-overlay))