aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--etc/NEWS4
-rw-r--r--lisp/ChangeLog2
-rw-r--r--lisp/simple.el25
3 files changed, 27 insertions, 4 deletions
diff --git a/etc/NEWS b/etc/NEWS
index f23204c1cd5..56ddf7531ce 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -165,6 +165,10 @@ makes the new region into the primary selection (for interaction with
165other window applications). If you enable this, you might want to bind 165other window applications). If you enable this, you might want to bind
166`mouse-yank-primary' to Mouse-2. 166`mouse-yank-primary' to Mouse-2.
167 167
168** If `yank-pop-change-selection' is t, rotating the kill ring
169also updates the selection or clipboard to the current yank,
170just as M-w would do so with the text it copies to the kill ring.
171
168** Minibuffer changes: 172** Minibuffer changes:
169 173
170*** In C-x d, if you type M-n you get the visited file name of the 174*** In C-x d, if you type M-n you get the visited file name of the
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 27a302d7d01..0c80dccccf1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -2,6 +2,8 @@
2 2
3 * simple.el (select-active-regions): New option. 3 * simple.el (select-active-regions): New option.
4 (set-mark): Obey it. 4 (set-mark): Obey it.
5 (yank-pop-change-selection): New option.
6 (current-kill): Obey it.
5 7
62007-12-25 David Golden <david.delaharpe.golden@gmail.com> (tiny change) 82007-12-25 David Golden <david.delaharpe.golden@gmail.com> (tiny change)
7 9
diff --git a/lisp/simple.el b/lisp/simple.el
index f4a5b51a68c..3a17af8a3d3 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -2659,13 +2659,26 @@ If `interprogram-cut-function' is set, pass the resulting kill to it."
2659 (equal yank-handler (get-text-property 0 'yank-handler cur))) 2659 (equal yank-handler (get-text-property 0 'yank-handler cur)))
2660 yank-handler))) 2660 yank-handler)))
2661 2661
2662(defcustom yank-pop-change-selection nil
2663 "If non-nil, rotating the kill ring changes the window system selection."
2664 :type 'boolean
2665 :group 'killing
2666 :version "23.1")
2667
2662(defun current-kill (n &optional do-not-move) 2668(defun current-kill (n &optional do-not-move)
2663 "Rotate the yanking point by N places, and then return that kill. 2669 "Rotate the yanking point by N places, and then return that kill.
2664If N is zero, `interprogram-paste-function' is set, and calling it returns a 2670If N is zero, `interprogram-paste-function' is set, and calling it returns a
2665string or list of strings, then that string (or list) is added to the front 2671string or list of strings, then that string (or list) is added to the front
2666of the kill ring and the string (or first string in the list) is returned as 2672of the kill ring and the string (or first string in the list) is returned as
2667the latest kill. If optional arg DO-NOT-MOVE is non-nil, then don't 2673the latest kill.
2668actually move the yanking point; just return the Nth kill forward." 2674
2675If N is not zero, and if `yank-pop-change-selection' is
2676non-nil, use `interprogram-cut-function' to transfer the
2677kill at the new yank point into the window system selection.
2678
2679If optional arg DO-NOT-MOVE is non-nil, then don't actually
2680move the yanking point; just return the Nth kill forward."
2681
2669 (let ((interprogram-paste (and (= n 0) 2682 (let ((interprogram-paste (and (= n 0)
2670 interprogram-paste-function 2683 interprogram-paste-function
2671 (funcall interprogram-paste-function)))) 2684 (funcall interprogram-paste-function))))
@@ -2684,8 +2697,12 @@ actually move the yanking point; just return the Nth kill forward."
2684 (nthcdr (mod (- n (length kill-ring-yank-pointer)) 2697 (nthcdr (mod (- n (length kill-ring-yank-pointer))
2685 (length kill-ring)) 2698 (length kill-ring))
2686 kill-ring))) 2699 kill-ring)))
2687 (or do-not-move 2700 (unless do-not-move
2688 (setq kill-ring-yank-pointer ARGth-kill-element)) 2701 (setq kill-ring-yank-pointer ARGth-kill-element)
2702 (when (and yank-pop-change-selection
2703 (> n 0)
2704 interprogram-cut-function)
2705 (funcall interprogram-cut-function (car ARGth-kill-element))))
2689 (car ARGth-kill-element))))) 2706 (car ARGth-kill-element)))))
2690 2707
2691 2708