changeset 7090:cf0b24d47cdd

(tar-copy): Don't bother with a temp buffer.
author Karl Heuer <kwzh@gnu.org>
date Mon, 25 Apr 1994 18:26:20 +0000
parents 3088496208ce
children cb7cc8672ea9
files lisp/tar-mode.el
diffstat 1 files changed, 4 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/tar-mode.el	Mon Apr 25 18:15:06 1994 +0000
+++ b/lisp/tar-mode.el	Mon Apr 25 18:26:20 1994 +0000
@@ -749,23 +749,10 @@
 	 (size (tar-header-size tokens))
 	 (start (+ (tar-desc-data-start descriptor) tar-header-offset -1))
 	 (end (+ start size)))
-    (let* ((tar-buffer (current-buffer))
-	   buffer)
-      (unwind-protect
-	  (progn
-	    (setq buffer (generate-new-buffer "*tar-copy-tmp*"))
-	    (widen)
-	    (save-excursion
-	      (set-buffer buffer)
-	      (insert-buffer-substring tar-buffer start end)
-	      (set-buffer-modified-p nil) ; in case we abort
-	      (write-file to-file)
-	      (message "Copied tar entry %s to %s" name to-file)
-	      (set-buffer tar-buffer)))
-	(narrow-to-region 1 tar-header-offset)
-	(if buffer (kill-buffer buffer)))
-      )))
-
+    (save-restriction
+      (widen)
+      (write-region start end to-file))
+    (message "Copied tar entry %s to %s" name to-file)))
 
 (defun tar-flag-deleted (p &optional unflag)
   "*In Tar mode, mark this sub-file to be deleted from the tar file.