changeset 53662:6f5e6bdd8cda

Enable clipboard on the menu bar and make Paste from the menu bar first use clipboard. For compliance with freedesktop.org.
author Jan Djärv <jan.h.d@swipnet.se>
date Wed, 21 Jan 2004 10:56:29 +0000
parents 41bc433c6843
children 34fd515d8bb8
files lisp/ChangeLog lisp/term/x-win.el
diffstat 2 files changed, 22 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Jan 21 05:47:54 2004 +0000
+++ b/lisp/ChangeLog	Wed Jan 21 10:56:29 2004 +0000
@@ -1,3 +1,8 @@
+2004-01-21  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* term/x-win.el: Call menu-bar-enable-clipboard and make Paste
+	use clipboard first.
+
 2004-01-20  Stefan Monnier  <monnier@iro.umontreal.ca>
 
 	* outline.el (outline-insert-heading): Tighten up match.
--- a/lisp/term/x-win.el	Wed Jan 21 05:47:54 2004 +0000
+++ b/lisp/term/x-win.el	Wed Jan 21 10:56:29 2004 +0000
@@ -2385,12 +2385,6 @@
 	;; 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.
@@ -2456,5 +2450,22 @@
 ;; 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.
+(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)))
+
+(define-key menu-bar-edit-menu [paste]
+  (cons "Paste" (cons "Paste text from clipboard or kill ring"
+		      'x-clipboard-yank)))
+
 ;;; arch-tag: f1501302-db8b-4d95-88e3-116697d89f78
 ;;; x-win.el ends here