Function: mouse-drag-secondary-pasting
mouse-drag-secondary-pasting is an interactive and byte-compiled
function defined in mouse-copy.el.gz.
Signature
(mouse-drag-secondary-pasting START-EVENT)
Documentation
Drag out a secondary selection, then paste it at the current point.
To test this function, evaluate:
(keymap-global-set "M-<down-mouse-1>"
'mouse-drag-secondary-pasting)
put the point at one place, then click and drag over some other region.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mouse-copy.el.gz
(defun mouse-drag-secondary-pasting (start-event)
"Drag out a secondary selection, then paste it at the current point.
To test this function, evaluate:
(keymap-global-set \"M-<down-mouse-1>\"
\\='mouse-drag-secondary-pasting)
put the point at one place, then click and drag over some other region."
(interactive "e")
;; Work-around: We see and react to each part of a multi-click event
;; as it proceeds. For a triple-event, this means the double-event
;; has already copied something that the triple-event will re-copy
;; (a Bad Thing). We therefore undo the prior insertion if we're on
;; a multiple event.
(if (and mouse-copy-last-paste-start
(>= (event-click-count start-event) 2))
(delete-region mouse-copy-last-paste-start
mouse-copy-last-paste-end))
;; HACK: We assume that mouse-drag-secondary returns nil if
;; there's no secondary selection. This assumption holds as of
;; emacs-19.22 but is not documented. It's not clear that there's
;; any other way to get this information.
(if (mouse-drag-secondary start-event)
(progn
(if mouse-copy-have-drag-bug
(mouse-copy-work-around-drag-bug start-event last-input-event))
;; Remember what we do so we can undo it, if necessary.
(setq mouse-copy-last-paste-start (point))
(insert (gui-get-selection 'SECONDARY))
(setq mouse-copy-last-paste-end (point)))
(setq mouse-copy-last-paste-start nil)))