]> git.eshelyaron.com Git - emacs.git/commitdiff
clipboard should still work even if interprogram-* is disabled
authorSam Steingold <sds@gnu.org>
Tue, 22 Dec 2015 17:02:30 +0000 (12:02 -0500)
committerSam Steingold <sds@gnu.org>
Tue, 22 Dec 2015 17:02:30 +0000 (12:02 -0500)
(clipboard-yank): When `interprogram-cut-function' is nil,
bind it to `gui-selection-value' - the default value.
(clipboard-kill-region, clipboard-kill-ring-save): When
`interprogram-paste-function' is nil, bind it to `gui-select-text' -
the default value.

lisp/menu-bar.el

index 42f48c784e1997cda2986ec4ee9777e184aa4dc1..b22c1eab907d9697c9f0b12fcd60e4e585d80c36 100644 (file)
 (defun clipboard-yank ()
   "Insert the clipboard contents, or the last stretch of killed text."
   (interactive "*")
-  (let ((gui-select-enable-clipboard t))
+  (let ((gui-select-enable-clipboard t)
+        (interprogram-paste-function (or interprogram-paste-function
+                                         #'gui-selection-value)))
     (yank)))
 
 (defun clipboard-kill-ring-save (beg end &optional region)
   "Copy region to kill ring, and save in the GUI's clipboard."
   (interactive "r\np")
-  (let ((gui-select-enable-clipboard t))
+  (let ((gui-select-enable-clipboard t)
+        (interprogram-cut-function (or interprogram-cut-function
+                                       #'gui-select-text)))
     (kill-ring-save beg end region)))
 
 (defun clipboard-kill-region (beg end &optional region)
   "Kill the region, and save it in the GUI's clipboard."
   (interactive "r\np")
-  (let ((gui-select-enable-clipboard t))
+  (let ((gui-select-enable-clipboard t)
+        (interprogram-cut-function (or interprogram-cut-function
+                                       #'gui-select-text)))
     (kill-region beg end region)))
 
 (defun menu-bar-enable-clipboard ()