summaryrefslogtreecommitdiff
path: root/lisp/term
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2004-01-21 10:56:29 +0000
committerJan Djärv <jan.h.d@swipnet.se>2004-01-21 10:56:29 +0000
commita5bfbd4e678c844ba751e7ad7ab0dabca344eb01 (patch)
tree85aa0a6e59aca9b74a4c1a9bfbc6f8da03c1db80 /lisp/term
parent371b1542e5fc93c50e0b09841990e491c44233ae (diff)
downloademacs-a5bfbd4e678c844ba751e7ad7ab0dabca344eb01.tar.gz
Enable clipboard on the menu bar and make Paste from the menu bar first
use clipboard. For compliance with freedesktop.org.
Diffstat (limited to 'lisp/term')
-rw-r--r--lisp/term/x-win.el23
1 files changed, 17 insertions, 6 deletions
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index d6260cb0bf7..9e37943032b 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -2385,12 +2385,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.
@@ -2456,5 +2450,22 @@ 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.
+(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