[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EOL conversion of files in .tar archives
From: |
Eli Zaretskii |
Subject: |
Re: EOL conversion of files in .tar archives |
Date: |
Tue, 22 May 2007 15:21:38 +0300 |
> Date: Tue, 22 May 2007 14:19:14 +0300
> From: Eli Zaretskii <address@hidden>
> Cc: address@hidden
>
> I'd like to suggest an alternative change that is local to
> tar-mode.el, see below.
Sorry, that patch was incomplete, and so did an imperfect job. Please
use the one below.
Index: lisp/tar-mode.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/tar-mode.el,v
retrieving revision 1.108
diff -u -r1.108 tar-mode.el
--- lisp/tar-mode.el 21 Jan 2007 03:53:10 -0000 1.108
+++ lisp/tar-mode.el 22 May 2007 12:19:49 -0000
@@ -681,6 +681,12 @@
(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)
@@ -735,9 +741,17 @@
(save-excursion
(funcall set-auto-coding-function
name (- (point-max) (point)))))
- (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 is
+ ;; auto-detected.
+ (let ((file-name-handler-alist
+ '(("" . tar-file-name-handler))))
+ (car (find-operation-coding-system
+ 'insert-file-contents
+ (cons name (current-buffer)) t)))))
(multibyte enable-multibyte-characters)
(detected (detect-coding-region
(point-min)
@@ -758,7 +772,7 @@
(coding-system-change-text-conversion
coding 'raw-text)))
(decode-coding-region (point-min) (point-max) coding)
- (set-buffer-file-coding-system coding))
+ (set-buffer-file-coding-system last-coding-system-used t))
;; Set the default-directory to the dir of the
;; superior buffer.
(setq default-directory
- Re: EOL conversion of files in .tar archives, (continued)
- Re: EOL conversion of files in .tar archives, Richard Stallman, 2007/05/22
- Re: EOL conversion of files in .tar archives, Eli Zaretskii, 2007/05/22
- Re: EOL conversion of files in .tar archives, Richard Stallman, 2007/05/22
- Re: EOL conversion of files in .tar archives, David Kastrup, 2007/05/22
- Re: EOL conversion of files in .tar archives, Richard Stallman, 2007/05/22
- Re: EOL conversion of files in .tar archives, Eli Zaretskii, 2007/05/22
Re: EOL conversion of files in .tar archives, Eli Zaretskii, 2007/05/22
Re: EOL conversion of files in .tar archives, Chong Yidong, 2007/05/22
Re: EOL conversion of files in .tar archives, Kenichi Handa, 2007/05/23
Re: EOL conversion of files in .tar archives, Eli Zaretskii, 2007/05/23
Re: EOL conversion of files in .tar archives, Eli Zaretskii, 2007/05/23
Re: EOL conversion of files in .tar archives, Kenichi Handa, 2007/05/23
Re: EOL conversion of files in .tar archives, Eli Zaretskii, 2007/05/23