aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1993-02-01 22:31:17 +0000
committerJim Blandy1993-02-01 22:31:17 +0000
commit2aa7a8bfe569d2e0fe9bc7c36378cc9abcf6575d (patch)
treebf735595d3f240c476d9ba3d64c12cf5fcdad470
parentcbbc8d275ad58fc7a63ce94b7ef6bcd688359a00 (diff)
downloademacs-2aa7a8bfe569d2e0fe9bc7c36378cc9abcf6575d.tar.gz
emacs-2aa7a8bfe569d2e0fe9bc7c36378cc9abcf6575d.zip
* simple.el (kill-region): If the buffer is read-only, do beep,
but also put the region in the kill ring. Doc fix.
-rw-r--r--lisp/simple.el20
1 files changed, 15 insertions, 5 deletions
diff --git a/lisp/simple.el b/lisp/simple.el
index 2a47c9d54cd..695f1196730 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -969,6 +969,9 @@ yanking point; just return the Nth kill forward."
969The text is deleted but saved in the kill ring. 969The text is deleted but saved in the kill ring.
970The command \\[yank] can retrieve it from there. 970The command \\[yank] can retrieve it from there.
971\(If you want to kill and then yank immediately, use \\[copy-region-as-kill].) 971\(If you want to kill and then yank immediately, use \\[copy-region-as-kill].)
972If the buffer is read-only, Emacs will beep and refrain from deleting
973the text, but put the text in the kill ring anyway. This means that
974you can use the killing commands to copy text from a read-only buffer.
972 975
973This is the primitive for programs to kill text (as opposed to deleting it). 976This is the primitive for programs to kill text (as opposed to deleting it).
974Supply two arguments, character numbers indicating the stretch of text 977Supply two arguments, character numbers indicating the stretch of text
@@ -977,12 +980,18 @@ Any command that calls this function is a \"kill command\".
977If the previous command was also a kill command, 980If the previous command was also a kill command,
978the text killed this time appends to the text killed last time 981the text killed this time appends to the text killed last time
979to make one entry in the kill ring." 982to make one entry in the kill ring."
980 (interactive "*r") 983 (interactive "r")
981 (cond 984 (cond
982 ;; If the buffer was read-only, we used to just do a 985
983 ;; copy-region-as-kill. This was never what I wanted - usually I 986 ;; If the buffer is read-only, we should beep, in case the person
984 ;; was making a mistake and trying to edit a file checked into RCS - 987 ;; just isn't aware of this. However, there's no harm in putting
985 ;; so I've taken the code out. 988 ;; the region's text in the kill ring, anyway.
989 (buffer-read-only
990 (copy-region-as-kill beg end)
991 (ding))
992
993 ;; In certain cases, we can arrange for the undo list and the kill
994 ;; ring to share the same string object. This code does that.
986 ((not (or (eq buffer-undo-list t) 995 ((not (or (eq buffer-undo-list t)
987 (eq last-command 'kill-region) 996 (eq last-command 'kill-region)
988 (eq beg end))) 997 (eq beg end)))
@@ -993,6 +1002,7 @@ to make one entry in the kill ring."
993 ;; and put it in the kill-ring. 1002 ;; and put it in the kill-ring.
994 (kill-new (car (car buffer-undo-list))) 1003 (kill-new (car (car buffer-undo-list)))
995 (setq this-command 'kill-region))) 1004 (setq this-command 'kill-region)))
1005
996 (t 1006 (t
997 (copy-region-as-kill beg end) 1007 (copy-region-as-kill beg end)
998 (delete-region beg end)))) 1008 (delete-region beg end))))