From c328399020e81d7b69c57d1df3363acbc4cf3f1b Mon Sep 17 00:00:00 2001 From: Martin Rudalics Date: Mon, 19 Nov 2007 07:48:56 +0000 Subject: [PATCH] (top-level): Deactivate clipboard-kill-region and clipboard-yank when the buffer is read-only. --- lisp/menu-bar.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el index c05a4e66a9a..ca20f6182fc 100644 --- a/lisp/menu-bar.el +++ b/lisp/menu-bar.el @@ -504,11 +504,14 @@ A large number or nil slows down menu responsiveness." ;; These are alternative definitions for the cut, paste and copy ;; menu items. Use them if your system expects these to use the clipboard. -(put 'clipboard-kill-region 'menu-enable 'mark-active) +(put 'clipboard-kill-region 'menu-enable + '(and mark-active (not buffer-read-only))) (put 'clipboard-kill-ring-save 'menu-enable 'mark-active) (put 'clipboard-yank 'menu-enable - '(or (and (fboundp 'x-selection-exists-p) (x-selection-exists-p)) - (x-selection-exists-p 'CLIPBOARD))) + '(and (or (and (fboundp 'x-selection-exists-p) + (x-selection-exists-p)) + (x-selection-exists-p 'CLIPBOARD)) + (not buffer-read-only))) (defun clipboard-yank () "Insert the clipboard contents, or the last stretch of killed text." -- 2.39.2