]> code.delx.au - gnu-emacs/blobdiff - lisp/menu-bar.el
(rmail-select-summary): Preserve rmail buffer's value of
[gnu-emacs] / lisp / menu-bar.el
index 8848dacf2c2e86b7d29b9433f357bbad1be03da0..c2536e2432f8dd358abb2b007717181827b7e065 100644 (file)
     (kill-region beg end)))
 
 (defun menu-bar-enable-clipboard ()
-  "Make the menu bar CUT, PASTE and COPY items use the clipboard."
+  "Make CUT, PASTE and COPY (keys and menu bar items) use the clipboard.
+Do the same for the keys of the same name."
   (interactive)
   ;; We can't use constant list structure here because it becomes pure,
   ;; and because it gets modified with cache data.
   (define-key menu-bar-edit-menu [copy]
     (cons "Copy" 'clipboard-kill-ring-save))
   (define-key menu-bar-edit-menu [cut]
-    (cons "Cut" 'clipboard-kill-region)))
-
-;; Sun expects these commands on these keys, so why not?
-(define-key global-map [f20] 'clipboard-kill-region)
-(define-key global-map [f16] 'clipboard-kill-ring-save)
-(define-key global-map [f18] 'clipboard-yank)
+    (cons "Cut" 'clipboard-kill-region))
+
+  (define-key global-map [f20] 'clipboard-kill-region)
+  (define-key global-map [f16] 'clipboard-kill-ring-save)
+  (define-key global-map [f18] 'clipboard-yank)
+  ;; X11R6 versions
+  (define-key global-map [cut] 'clipboard-kill-region)
+  (define-key global-map [copy] 'clipboard-kill-ring-save)
+  (define-key global-map [paste] 'clipboard-yank))
 \f
 (define-key menu-bar-help-menu [emacs-version]
   '("Show Version" . emacs-version))
@@ -287,7 +291,7 @@ A large number or nil slows down menu responsiveness.")
 
 (defun menu-bar-update-buffers ()
   ;; If user discards the Buffers item, play along.
-  (and (lookup-key global-map [menu-bar buffer])
+  (and (lookup-key (current-global-map) [menu-bar buffer])
        (frame-or-buffer-changed-p)
        (let ((buffers (buffer-list))
             (frames (frame-list))
@@ -375,7 +379,7 @@ A large number or nil slows down menu responsiveness.")
             (setq buffers-menu (cons 'keymap buffers-menu)))
         (if frames-menu
             (setq frames-menu (cons 'keymap frames-menu)))
-        (define-key global-map [menu-bar buffer]
+        (define-key (current-global-map) [menu-bar buffer]
           (cons "Buffers"
                 (if (and buffers-menu frames-menu)
                     (list 'keymap "Buffers and Frames"