* menu-bar.el: x-selection-exists-p
@ 2009-03-03 4:24 David Reitter
2009-03-03 14:15 ` Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: David Reitter @ 2009-03-03 4:24 UTC (permalink / raw)
To: Emacs-Devel devel
menu-bar.el contains two uses of `x-selection-exists-p', which is not
defined if Emacs was built with "--without-x".
The first appears to disable the Paste menu item permanently; the
second one calls the function even if it doesn't exist (even though
I'm not sure if the `menu-enable' property on `clipboard-yank' does
what it appears to do).
Are the below changes OK, and is it OK to check this in at this point?
Index: menu-bar.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/menu-bar.el,v
retrieving revision 1.350
diff -c -r1.350 menu-bar.el
*** menu-bar.el 14 Jan 2009 23:11:12 -0000 1.350
--- menu-bar.el 3 Mar 2009 04:11:59 -0000
***************
*** 459,466 ****
: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))
:help "Paste (yank) text most recently cut/copied"))
(define-key menu-bar-edit-menu [copy]
'(menu-item "Copy" menu-bar-kill-ring-save
--- 485,493 ----
:enable (and
;; Emacs compiled --without-x doesn't have
;; x-selection-exists-p.
! (if (fboundp 'x-selection-exists-p)
! (x-selection-exists-p) t)
! (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,503 ****
'(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))
! (x-selection-exists-p 'CLIPBOARD))
(not buffer-read-only)))
(defun clipboard-yank ()
--- 527,535 ----
'(and mark-active (not buffer-read-only)))
(put 'clipboard-kill-ring-save 'menu-enable 'mark-active)
(put 'clipboard-yank 'menu-enable
! '(and (if (fboundp 'x-selection-exists-p)
! (or (x-selection-exists-p)
! (x-selection-exists-p 'CLIPBOARD)))
(not buffer-read-only)))
(defun clipboard-yank ()
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: menu-bar.el: x-selection-exists-p
2009-03-03 4:24 menu-bar.el: x-selection-exists-p David Reitter
@ 2009-03-03 14:15 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2009-03-03 14:15 UTC (permalink / raw)
To: David Reitter; +Cc: Emacs-Devel devel
> Are the below changes OK, and is it OK to check this in at this point?
The second change is OK (I'd fold the "if" into that "and", but that's
just me). The first doesn't seem quite right: I think it should test
something like:
(or (and (fboundp 'x-selection-exists-p) (x-selection-exists-p))
kill-ring)
to better reflect the fact that `yank' either uses the selection or the
kill-ring.
Thanks for spotting this.
Stefan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-03-03 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-03 4:24 menu-bar.el: x-selection-exists-p David Reitter
2009-03-03 14:15 ` Stefan Monnier
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.