diff options
author | Miles Bader <miles@gnu.org> | 2007-05-24 21:31:10 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2007-05-24 21:31:10 +0000 |
commit | 262be72a9aaa800d38cd25b12acb8c9b7b21d5d6 (patch) | |
tree | 0940ebc7acd6379243e7194446acbd4f062be4f3 /lisp/tar-mode.el | |
parent | 5e1d0c0a38c22adc02d1b77bdc1d620fab26e52d (diff) | |
parent | a02a3c235e3ec24acaf2014e6c60c0b4138ff86f (diff) | |
download | emacs-262be72a9aaa800d38cd25b12acb8c9b7b21d5d6.tar.gz |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 751-770)
- Update from CVS
- Merge from emacs--rel--22
- Update from CVS: lisp/textmodes/sgml-mode.el: Revert last change.
- Merge from gnus--rel--5.10
* emacs--rel--22 (patch 18-25)
* gnus--rel--5.10 (patch 222-223)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-208
Diffstat (limited to 'lisp/tar-mode.el')
-rw-r--r-- | lisp/tar-mode.el | 42 |
1 files changed, 30 insertions, 12 deletions
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index 1d0c0ec6e09..49b2e3c2bbd 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -361,6 +361,7 @@ MODE should be an integer which is a file mode value." ((eq type 29) ?M) ; multivolume continuation ((eq type 35) ?S) ; sparse ((eq type 38) ?V) ; volume header + ((eq type 55) ?H) ; extended pax header (t ?\s) ) (tar-grind-file-mode mode) @@ -420,7 +421,7 @@ is visible (and the real data of the buffer is hidden)." (buffer-substring pos (+ pos 512))))))) (setq pos (+ pos 512)) (progress-reporter-update progress-reporter pos) - (if (eq (tar-header-link-type tokens) 20) + (if (memq (tar-header-link-type tokens) '(20 55)) ;; Foo. There's an extra empty block after these. (setq pos (+ pos 512))) (let ((size (tar-header-size tokens))) @@ -662,13 +663,14 @@ appear on disk when you save the tar-file's buffer." (size (tar-header-size tokens)) (link-p (tar-header-link-type tokens))) (if link-p - (error "This is a %s, not a real file" - (cond ((eq link-p 5) "directory") - ((eq link-p 20) "tar directory header") - ((eq link-p 28) "next has longname") - ((eq link-p 29) "multivolume-continuation") - ((eq link-p 35) "sparse entry") - ((eq link-p 38) "volume header") + (error "This is a%s, not a real file" + (cond ((eq link-p 5) " directory") + ((eq link-p 20) " tar directory header") + ((eq link-p 28) " next has longname") + ((eq link-p 29) " multivolume-continuation") + ((eq link-p 35) " sparse entry") + ((eq link-p 38) " volume header") + ((eq link-p 55) "n extended pax header") (t "link")))) (if (zerop size) (error "This is a zero-length file")) descriptor)) @@ -686,6 +688,12 @@ appear on disk when you save the tar-file's buffer." (goto-char (posn-point (event-end event))) (tar-extract)) +(defun tar-file-name-handler (op &rest args) + "Helper function for `tar-extract'." + (or (eq op 'file-exists-p) + (let ((file-name-handler-alist nil)) + (apply op args)))) + (defun tar-extract (&optional other-window-p) "In Tar mode, extract this entry of the tar file into its own buffer." (interactive) @@ -727,9 +735,17 @@ appear on disk when you save the tar-file's buffer." (and set-auto-coding-function (funcall set-auto-coding-function name (- end start))) - (car (find-operation-coding-system - 'insert-file-contents - (cons name (current-buffer)) t)))) + ;; The following binding causes + ;; find-buffer-file-type-coding-system + ;; (defined on dos-w32.el) to act as if + ;; the file being extracted existed, so + ;; that the file's contents' encoding and + ;; EOL format are auto-detected. + (let ((file-name-handler-alist + '(("" . tar-file-name-handler)))) + (car (find-operation-coding-system + 'insert-file-contents + (cons name (current-buffer)) t))))) (if (or (not coding) (eq (coding-system-type coding) 'undecided)) (setq coding (detect-coding-region start end t))) @@ -746,7 +762,9 @@ appear on disk when you save the tar-file's buffer." (setq buffer-file-name new-buffer-file-name) (setq buffer-file-truename (abbreviate-file-name buffer-file-name)) - (set-buffer-file-coding-system coding) + ;; Force buffer-file-coding-system to what + ;; decode-coding-region actually used. + (set-buffer-file-coding-system last-coding-system-used t) ;; Set the default-directory to the dir of the ;; superior buffer. (setq default-directory |