diff options
| author | Richard M. Stallman | 2002-03-08 09:54:42 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-03-08 09:54:42 +0000 |
| commit | 27129192f52aa06774ef7d6dc3ec3fa8c36842d7 (patch) | |
| tree | e0077accec2caba29f5298e8b5e9b0d844807109 | |
| parent | 24f6a9876516f8b3dd6fcaaf4b1dfb9f78c92121 (diff) | |
| download | emacs-27129192f52aa06774ef7d6dc3ec3fa8c36842d7.tar.gz emacs-27129192f52aa06774ef7d6dc3ec3fa8c36842d7.zip | |
(tar-untar-buffer): New function.
| -rw-r--r-- | lisp/tar-mode.el | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 2bfd75c7630..576d8be02e6 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el | |||
| @@ -373,6 +373,27 @@ MODE should be an integer which is a file mode value." | |||
| 373 | (concat (if (= type 1) " ==> " " --> ") link-name) | 373 | (concat (if (= type 1) " ==> " " --> ") link-name) |
| 374 | "")))) | 374 | "")))) |
| 375 | 375 | ||
| 376 | (defun tar-untar-buffer () | ||
| 377 | "Extract all archive members in the tar-file." | ||
| 378 | (interactive) | ||
| 379 | (let ((multibyte enable-multibyte-characters)) | ||
| 380 | (unwind-protect | ||
| 381 | (save-restriction | ||
| 382 | (widen) | ||
| 383 | (set-buffer-multibyte nil) | ||
| 384 | (dolist (descriptor tar-parse-info) | ||
| 385 | (let* ((tokens (tar-desc-tokens descriptor)) | ||
| 386 | (name (tar-header-name tokens)) | ||
| 387 | (dir (file-name-directory name)) | ||
| 388 | (start (+ (tar-desc-data-start descriptor) tar-header-offset -1)) | ||
| 389 | (end (+ start (tar-header-size tokens)))) | ||
| 390 | (message "Extracting %s" name) | ||
| 391 | (if (and dir (not (file-exists-p dir))) | ||
| 392 | (make-directory dir t)) | ||
| 393 | (write-region start end name) | ||
| 394 | (set-file-modes name (tar-header-mode tokens))))) | ||
| 395 | (set-buffer-multibyte multibyte)))) | ||
| 396 | |||
| 376 | (defun tar-summarize-buffer () | 397 | (defun tar-summarize-buffer () |
| 377 | "Parse the contents of the tar file in the current buffer. | 398 | "Parse the contents of the tar file in the current buffer. |
| 378 | Place a dired-like listing on the front; | 399 | Place a dired-like listing on the front; |