From 63571b5a84eaec1b14768d284f4613502810a1d7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 25 Dec 2007 20:09:05 +0000 Subject: [PATCH] (mouse-yank-primary): New function (almost same as mouse-yank-secondary). --- etc/NEWS | 14 +++++++++++--- lisp/ChangeLog | 13 +++++++++++++ lisp/mouse.el | 14 ++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index d7e7f0f93c6..f23204c1cd5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -157,9 +157,13 @@ in Transient Mark mode should make commands operate on that empty region. ** New command kill-matching-buffers kills buffers whose name matches a regexp. -** `interprogram-paste-function' can now return one string or a list -of strings. In the latter case, Emacs puts the second and following -strings on the kill ring. +** You can disable kill ring commands from accessing the primary selection +by setting `x-select-enable-primary' to nil. + +** If `select-active-regions' is t, setting the mark automatically +makes the new region into the primary selection (for interaction with +other window applications). If you enable this, you might want to bind +`mouse-yank-primary' to Mouse-2. ** Minibuffer changes: @@ -457,6 +461,10 @@ the specified files). ** The new function `read-color' reads a color name using the minibuffer. +** `interprogram-paste-function' can now return one string or a list +of strings. In the latter case, Emacs puts the second and following +strings on the kill ring. + ** Changes related to multiple tty support. *** $TERM is now set to `dumb' for subprocesses. If you want to know the diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cca6ee0b296..27a302d7d01 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2007-12-25 Richard Stallman + + * simple.el (select-active-regions): New option. + (set-mark): Obey it. + +2007-12-25 David Golden (tiny change) + + * term/x-win.el (x-select-enable-primary): New option. + (x-select-text, x-cut-buffer-or-selection-value): Obey it. + + * mouse.el (mouse-yank-primary): New function (almost same + as mouse-yank-secondary). + 2007-12-25 Dan Nicolaescu * calculator.el: 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]." -- 2.39.2