>>>> "Jan" == Jan Vroonhof
<jan.vroonhof(a)insignia.com> writes:
Jan> Dan Holmsand <dan(a)innehallsbolaget.com> writes:
> >
http://www.xemacs.org/list-archives/xemacs-patches/199906/msg00050.html
>
> OK, I see. Btw there seems to be a typo in the patch: it says
> coding-system-for-read twice in the let clause. Fsfmacs has
> coding-system-for-write the second time.
Jan> Thank you. It should be changed. It shouldn't matter though
Jan> as this we are supposed to be doing only reading.
Hi Jan, Dan, Michael!
I have tested as suggested by Michael and am delighted to report success.
I intend to commit this against release-21-2 CVS shortly:
Gotta shatter that perception of being a shy guy ;->
I intend to apply and test this against 21.1.11 as well since this is
a showstopper AFAIAC.
Best regards,
Adrian
lisp/ChangeLog:
2000-07-28 Adrian Aichner <aichner(a)ecf.teradyne.com>
* files.el (insert-file-contents-literally): Fix second let
binding for `coding-system-for-read' to `coding-system-for-write'
as suggested by Dan Holmsand <dan(a)innehallsbolaget.com>.
1999-06-15 Jan Vroonhof <vroonhof(a)math.ethz.ch>
* files.el (insert-file-contents-literally): Use binary coding
system (from Morioka san).
(insert-file-contents-literally): Make file-name-handler method.
top-level patch:
cd d:\tmp\21.2\xemacs\
cvs diff lisp/files.el
Compilation started at Fri Jul 28 15:22:11 2000 +0200 (W. Europe Daylight Time)
Index: lisp/files.el
===================================================================
RCS file: /usr/CVSroot/XEmacs/xemacs/lisp/files.el,v
retrieving revision 1.27.2.23
diff -u -r1.27.2.23 files.el
--- files.el 2000/06/30 08:44:10 1.27.2.23
+++ files.el 2000/07/28 13:27:07
@@ -873,23 +873,31 @@
(defun insert-file-contents-literally (filename &optional visit beg end replace)
"Like `insert-file-contents', q.v., but only reads in the file.
A buffer may be modified in several ways after reading into the buffer due
-to advanced Emacs features, such as file-name-handlers, format decoding,
-find-file-hooks, etc.
+to advanced Emacs features, such as format decoding, character code
+conversion,find-file-hooks, automatic uncompression, etc.
+
This function ensures that none of these modifications will take place."
- (let ((file-name-handler-alist nil)
- (format-alist nil)
- (after-insert-file-functions nil)
- (find-buffer-file-type-function
- (if (fboundp 'find-buffer-file-type)
- (symbol-function 'find-buffer-file-type)
- nil)))
- (unwind-protect
- (progn
- (fset 'find-buffer-file-type (lambda (filename) t))
- (insert-file-contents filename visit beg end replace))
- (if find-buffer-file-type-function
- (fset 'find-buffer-file-type find-buffer-file-type-function)
- (fmakunbound 'find-buffer-file-type)))))
+ (let ((wrap-func (find-file-name-handler filename
+ 'insert-file-contents-literally)))
+ (if wrap-func
+ (funcall wrap-func 'insert-file-contents-literally filename
+ visit beg end replace)
+ (let ((file-name-handler-alist nil)
+ (format-alist nil)
+ (after-insert-file-functions nil)
+ (coding-system-for-read 'binary)
+ (coding-system-for-write 'binary)
+ (find-buffer-file-type-function
+ (if (fboundp 'find-buffer-file-type)
+ (symbol-function 'find-buffer-file-type)
+ nil)))
+ (unwind-protect
+ (progn
+ (fset 'find-buffer-file-type (lambda (filename) t))
+ (insert-file-contents filename visit beg end replace))
+ (if find-buffer-file-type-function
+ (fset 'find-buffer-file-type find-buffer-file-type-function)
+ (fmakunbound 'find-buffer-file-type)))))))
(defun find-file-noselect (filename &optional nowarn rawfile)
"Read file FILENAME into a buffer and return the buffer.
Compilation exited abnormally with code 1 at Fri Jul 28 15:22:22
Jan> Jan
--
Adrian Aichner <adrian(a)xemacs.org>