diff options
| author | Richard M. Stallman | 1994-04-06 04:54:35 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-06 04:54:35 +0000 |
| commit | f9cf0be27289620ea98cbd61c1d80a07b04d1de8 (patch) | |
| tree | 9d7cde95408cdde1f5b6cc24a02730c8a24f8d6a | |
| parent | dc20df9586dd9a33e33ea5fddaca135f2ac654ff (diff) | |
| download | emacs-f9cf0be27289620ea98cbd61c1d80a07b04d1de8.tar.gz emacs-f9cf0be27289620ea98cbd61c1d80a07b04d1de8.zip | |
(clipboard-yank, clipboard-kill-ring-save)
(clipboard-kill-region): New functions. Give them
menu-enable properties and bind the PASTE, COPY and CUT keys.
(menu-bar-enable-clipboard): New function.
| -rw-r--r-- | lisp/menu-bar.el | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index ea6221ca710..8b51ba65119 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el | |||
| @@ -89,6 +89,43 @@ | |||
| 89 | 89 | ||
| 90 | (autoload 'ispell-menu-map "ispell" nil t 'keymap) | 90 | (autoload 'ispell-menu-map "ispell" nil t 'keymap) |
| 91 | 91 | ||
| 92 | ;; These are alternative definitions for the cut, paste and copy | ||
| 93 | ;; menu items. Use them if your system expects these to use the clipboard | ||
| 94 | |||
| 95 | (define-key global-map [cut] 'clipboard-kill-region) | ||
| 96 | (define-key global-map [copy] 'clipboard-kill-ring-save) | ||
| 97 | (define-key global-map [paste] 'clipboard-yank) | ||
| 98 | |||
| 99 | (put 'clipboard-kill-region 'menu-enable 'mark-active) | ||
| 100 | (put 'clipboard-kill-ring-save 'menu-enable 'mark-active) | ||
| 101 | (put 'clipboard-yank 'menu-enable | ||
| 102 | '(or (x-selection-exists-p) (x-selection-exists-p 'CLIPBOARD))) | ||
| 103 | |||
| 104 | (defun clipboard-yank () | ||
| 105 | "Reinsert the last stretch of killed text, or the clipboard contents." | ||
| 106 | (interactive) | ||
| 107 | (let ((x-select-enable-clipboard t)) | ||
| 108 | (yank))) | ||
| 109 | |||
| 110 | (defun clipboard-kill-ring-save (beg end) | ||
| 111 | "Copy region to kill ring, and save in the X clipboard." | ||
| 112 | (interactive "r") | ||
| 113 | (let ((x-select-enable-clipboard t)) | ||
| 114 | (kill-ring-save beg end))) | ||
| 115 | |||
| 116 | (defun clipboard-kill-region (beg end) | ||
| 117 | "Kill the region, and save it in the X clipboard." | ||
| 118 | (interactive "r") | ||
| 119 | (let ((x-select-enable-clipboard t)) | ||
| 120 | (kill-region beg end))) | ||
| 121 | |||
| 122 | (defun menu-bar-enable-clipboard () | ||
| 123 | "Make the menu bar CUT, PASTE and COPY items use the clipboard." | ||
| 124 | (interactive) | ||
| 125 | (define-key menu-bar-edit-menu [paste] '("Paste" . clipboard-yank)) | ||
| 126 | (define-key menu-bar-edit-menu [copy] '("Copy" . clipboard-kill-ring-save)) | ||
| 127 | (define-key menu-bar-edit-menu [cut] '("Cut" . clipboard-kill-region))) | ||
| 128 | |||
| 92 | (define-key menu-bar-help-menu [emacs-tutorial] | 129 | (define-key menu-bar-help-menu [emacs-tutorial] |
| 93 | '("Emacs Tutorial" . help-with-tutorial)) | 130 | '("Emacs Tutorial" . help-with-tutorial)) |
| 94 | (define-key menu-bar-help-menu [man] '("Man..." . manual-entry)) | 131 | (define-key menu-bar-help-menu [man] '("Man..." . manual-entry)) |