Subject: bug#6944: Paste in Edit menu not active at start

From: Eli Zaretskii <[email-masked]>
Date: Mon, 30 Aug 2010 19:56:31 +0300

> From: Lennart Borgman <[email-masked]>
> Date: Mon, 30 Aug 2010 12:32:56 +0200
> Cc: 
> 
> After starting Emacs with "emacs -Q" the "Paste" alternative is not
> active in the menu even though C-y works.

This happens because menu-bar.el defines the sensitivity of "Paste" as
follows:

  (define-key menu-bar-edit-menu [paste]
    `(menu-item ,(purecopy "Paste") yank
		: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))

and x-selection-exists-p with its argument omitted probes the PRIMARY
selection, which doesn't exist on MS-Windows.

I can easily fix that with an MS-Windows specific change, but I'm
actually surprised we don't call (x-selection-exists-p 'CLIPBOARD)
here: isn't C-y supposed to yank from the clipboard, not from PRIMARY?
If we use 'CLIPBOARD, the code will work on Windows without any
changes.

Am I missing something?