]> code.delx.au - gnu-emacs/blobdiff - lisp/term/x-win.el
Merged in changes from CVS HEAD
[gnu-emacs] / lisp / term / x-win.el
index e0233d64dbdaf82d154d93629f4139af932c634f..c69aa01c35623c4ff7f1b7387657bf0ca65d69c4 100644 (file)
@@ -2330,6 +2330,15 @@ order until succeed.")
     (or clip-text primary-text cut-text)
     ))
 
+(defun x-clipboard-yank ()
+  "Insert the clipboard contents, or the last stretch of killed text."
+  (interactive)
+  (let ((clipboard-text (x-get-selection 'CLIPBOARD))
+       (x-select-enable-clipboard t))
+    (if (and clipboard-text (> (length clipboard-text) 0))
+       (kill-new clipboard-text))
+    (yank)))
+
 \f
 ;;; Window system initialization.
 
@@ -2392,12 +2401,6 @@ order until succeed.")
          ;; generated from FONT.
          (create-fontset-from-ascii-font font resolved-name "startup"))))
 
-  ;; Sun expects the menu bar cut and paste commands to use the clipboard.
-  ;; This has ,? to match both on Sunos and on Solaris.
-  (if (string-match "Sun Microsystems,? Inc\\."
-                   (x-server-vendor))
-      (menu-bar-enable-clipboard))
-
   ;; Apply a geometry resource to the initial frame.  Put it at the end
   ;; of the alist, so that anything specified on the command line takes
   ;; precedence.
@@ -2463,6 +2466,14 @@ order until succeed.")
   ;; Turn on support for mouse wheels.
   (mouse-wheel-mode 1)
 
+  ;; Enable CLIPBOARD copy/paste through menu bar commands.
+  (menu-bar-enable-clipboard)
+
+  ;; Override Paste so it looks at CLIPBOARD first.
+  (define-key menu-bar-edit-menu [paste]
+    (cons "Paste" (cons "Paste text from clipboard or kill ring"
+                       'x-clipboard-yank)))
+
   (setq x-initialized t))
 
 (add-to-list 'handle-args-function-alist '(x . x-handle-args))