Function: tar-copy
tar-copy is an interactive and byte-compiled function defined in
tar-mode.el.gz.
Signature
(tar-copy &optional TO-FILE)
Documentation
In Tar mode, extract this entry of the tar file into a file on disk.
If TO-FILE is not supplied, it is prompted for, defaulting to the name of the current tar-entry.
If tar-copy-preserve-time is non-nil, the original
timestamp (if present in the tar file) will be used on the
extracted file.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/tar-mode.el.gz
(defun tar-copy (&optional to-file)
"In Tar mode, extract this entry of the tar file into a file on disk.
If TO-FILE is not supplied, it is prompted for, defaulting to the name of
the current tar-entry.
If `tar-copy-preserve-time' is non-nil, the original
timestamp (if present in the tar file) will be used on the
extracted file."
(interactive (list (tar-read-file-name)))
(let* ((descriptor (tar-get-descriptor))
(name (tar-header-name descriptor))
(size (tar-header-size descriptor))
(date (tar-header-date descriptor))
(start (tar-header-data-start descriptor))
(end (+ start size))
(inhibit-file-name-handlers inhibit-file-name-handlers)
(inhibit-file-name-operation inhibit-file-name-operation))
(with-current-buffer
(if (tar-data-swapped-p) tar-data-buffer (current-buffer))
;; Inhibit compressing a subfile again if *both* name and
;; to-file are handled by jka-compr
(if (and (eq (find-file-name-handler name 'write-region)
'jka-compr-handler)
(eq (find-file-name-handler to-file 'write-region)
'jka-compr-handler))
(setq inhibit-file-name-handlers
(cons 'jka-compr-handler
(and (eq inhibit-file-name-operation 'write-region)
inhibit-file-name-handlers))
inhibit-file-name-operation 'write-region))
(let ((coding-system-for-write 'no-conversion))
(write-region start end to-file nil nil nil t))
(when (and tar-copy-preserve-time
date)
(set-file-times to-file date 'nofollow)))
(message "Copied tar entry %s to %s" name to-file)))