changeset 102399:55ec3560f75e

(clipboard-yank): avoid checking (x-selection-exists-p) if unbound in order to enable the item. For paste menu item, same, and check kill-ring.
author David Reitter <david.reitter@gmail.com>
date Wed, 04 Mar 2009 18:57:53 +0000
parents 8b6630c538f9
children 934376007cef
files lisp/menu-bar.el
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/menu-bar.el	Wed Mar 04 18:57:30 2009 +0000
+++ b/lisp/menu-bar.el	Wed Mar 04 18:57:53 2009 +0000
@@ -456,11 +456,13 @@
 	      :help "Choose a string from the kill ring and paste it"))
 (define-key menu-bar-edit-menu [paste]
   '(menu-item "Paste" yank
-	      :enable (and
-		       ;; Emacs compiled --without-x doesn't have
-		       ;; x-selection-exists-p.
-		       (fboundp 'x-selection-exists-p)
-		       (x-selection-exists-p) (not buffer-read-only))
+	      :enable (and (or
+			    ;; Emacs compiled --without-x doesn't have
+			    ;; x-selection-exists-p.
+			    (and (fboundp 'x-selection-exists-p)
+				 (x-selection-exists-p))
+			    kill-ring)
+			   (not buffer-read-only))
 	      :help "Paste (yank) text most recently cut/copied"))
 (define-key menu-bar-edit-menu [copy]
   '(menu-item "Copy" menu-bar-kill-ring-save
@@ -495,10 +497,10 @@
      '(and mark-active (not buffer-read-only)))
 (put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
 (put 'clipboard-yank 'menu-enable
-     '(and (or (and (fboundp 'x-selection-exists-p)
-		    (x-selection-exists-p))
+     '(and (or (not (fboundp 'x-selection-exists-p))
+	       (x-selection-exists-p)
 	       (x-selection-exists-p 'CLIPBOARD))
-	   (not buffer-read-only)))
+ 	   (not buffer-read-only)))
 
 (defun clipboard-yank ()
   "Insert the clipboard contents, or the last stretch of killed text."