changeset 86231:b4b52674ba3c

(top-level): Deactivate clipboard-kill-region and clipboard-yank when the buffer is read-only.
author Martin Rudalics <rudalics@gmx.at>
date Mon, 19 Nov 2007 07:48:56 +0000
parents 79043dac5524
children 74f276f67957
files lisp/menu-bar.el
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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."