changeset 87387:e73e483c5735

(mouse-yank-primary): New function (almost same as mouse-yank-secondary).
author Richard M. Stallman <rms@gnu.org>
date Tue, 25 Dec 2007 20:05:47 +0000
parents 9ec633b7a53d
children 4f34a8e891bf
files lisp/mouse.el
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mouse.el	Tue Dec 25 20:02:45 2007 +0000
+++ b/lisp/mouse.el	Tue Dec 25 20:05:47 2007 +0000
@@ -1358,6 +1358,20 @@
   (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]."