]> git.eshelyaron.com Git - emacs.git/commitdiff
Adjust x-clipboard-yank for recent selection ownership changes
authorPo Lu <luangruo@yahoo.com>
Tue, 28 Jun 2022 10:25:50 +0000 (18:25 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 28 Jun 2022 10:25:50 +0000 (18:25 +0800)
* lisp/term/x-win.el (x-clipboard-yank): Don't own CLIPBOARD
inside kill-new.

lisp/term/x-win.el

index 32675a07b1fdb03e26f6f2e40cddef82a527751f..7c88c85ceff0bde038a5664e11a52bd0e4d4983d 100644 (file)
@@ -1182,8 +1182,12 @@ as returned by `x-server-vendor'."
   (interactive "*")
   (let ((clipboard-text (gui--selection-value-internal 'CLIPBOARD))
        (select-enable-clipboard t))
-    (if (and clipboard-text (> (length clipboard-text) 0))
-       (kill-new clipboard-text))
+    (when (and clipboard-text (> (length clipboard-text) 0))
+      ;; Avoid asserting ownership of CLIPBOARD, which will cause
+      ;; `gui-selection-value' to return nil in the future.
+      ;; (bug#56273)
+      (let ((select-enable-clipboard nil))
+        (kill-new clipboard-text)))
     (yank)))
 
 (declare-function accelerate-menu "xmenu.c" (&optional frame) t)