# HG changeset patch # User Martin Rudalics # Date 1195458536 0 # Node ID b4b52674ba3c3a57d21baa5a0537805c83df3bf9 # Parent 79043dac55246200a238a1cb193cc554ba305e99 (top-level): Deactivate clipboard-kill-region and clipboard-yank when the buffer is read-only. diff -r 79043dac5524 -r b4b52674ba3c lisp/menu-bar.el --- a/lisp/menu-bar.el Mon Nov 19 07:44:30 2007 +0000 +++ b/lisp/menu-bar.el Mon Nov 19 07:48:56 2007 +0000 @@ -504,11 +504,14 @@ ;; 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."