summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2007-12-25 20:09:05 +0000
committerRichard M. Stallman <rms@gnu.org>2007-12-25 20:09:05 +0000
commit63571b5a84eaec1b14768d284f4613502810a1d7 (patch)
tree9bd29456143c5784d38117c4590ada4fa05dfd5f /lisp/mouse.el
parent98b2fff491674a78037fdf8a3239c286908d8627 (diff)
downloademacs-63571b5a84eaec1b14768d284f4613502810a1d7.tar.gz
(mouse-yank-primary): New function (almost same as mouse-yank-secondary).
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 39882ca33c0..8802aa98317 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1358,6 +1358,20 @@ regardless of where you click."
(setq mouse-selection-click-count 0)
(yank arg))
+(defun mouse-yank-primary (click)
+ "Insert the primary selection at the position clicked on.
+Move point to the end of the inserted text.
+If `mouse-yank-at-point' is non-nil, insert at point
+regardless of where you click."
+ (interactive "e")
+ ;; Give temporary modes such as isearch a chance to turn off.
+ (run-hooks 'mouse-leave-buffer-hook)
+ (or mouse-yank-at-point (mouse-set-point click))
+ (let ((primary (x-get-selection 'PRIMARY)))
+ (if primary
+ (insert (x-get-selection 'PRIMARY))
+ (error "No primary selection"))))
+
(defun mouse-kill-ring-save (click)
"Copy the region between point and the mouse click in the kill ring.
This does not delete the region; it acts like \\[kill-ring-save]."