emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/rect.el


From: Eli Zaretskii
Subject: [Emacs-diffs] Changes to emacs/lisp/rect.el
Date: Sat, 08 Apr 2006 10:30:19 +0000

Index: emacs/lisp/rect.el
diff -u emacs/lisp/rect.el:1.51 emacs/lisp/rect.el:1.52
--- emacs/lisp/rect.el:1.51     Mon Feb  6 14:33:35 2006
+++ emacs/lisp/rect.el  Sat Apr  8 10:30:19 2006
@@ -141,8 +141,7 @@
       ;; else
       (setq pt (point))
       (move-to-column endcol t)
-      (setcdr lines (cons (buffer-substring pt (point)) (cdr lines)))
-      (delete-region pt (point)))
+      (setcdr lines (cons (filter-buffer-substring pt (point) t) (cdr lines))))
     ))
 
 ;; ### NOTE: this is actually the only function that needs to do complicated
@@ -233,12 +232,22 @@
 You might prefer to use `delete-extract-rectangle' from a program.
 
 With a prefix (or a FILL) argument, also fill lines where nothing has to be
-deleted."
-  (interactive "*r\nP")
-  (when buffer-read-only
-    (setq killed-rectangle (extract-rectangle start end))
-    (barf-if-buffer-read-only))
-  (setq killed-rectangle (delete-extract-rectangle start end fill)))
+deleted.
+
+If the buffer is read-only, Emacs will beep and refrain from deleting
+the rectangle, but put it in the kill ring anyway.  This means that
+you can use this command to copy text from a read-only buffer.
+\(If the variable `kill-read-only-ok' is non-nil, then this won't
+even beep.)"
+  (interactive "r\nP")
+  (condition-case nil
+      (setq killed-rectangle (delete-extract-rectangle start end fill))
+    ((buffer-read-only text-read-only)
+     (setq killed-rectangle (extract-rectangle start end))
+     (if kill-read-only-ok
+        (progn (message "Read only text copied to kill ring") nil)
+       (barf-if-buffer-read-only)
+       (signal 'text-read-only (list (current-buffer)))))))
 
 ;; this one is untouched --dv
 ;;;###autoload




reply via email to

[Prev in Thread] Current Thread [Next in Thread]