help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [h-e-w] File size anomoly


From: Robert Praetorius
Subject: Re: [h-e-w] File size anomoly
Date: Thu, 22 May 2003 08:26:41 -0400

> When emacs reads a file into a buffer, it apparently uses what it thinks
> is the file size and only reads that many characters into it's input
> buffer. If the file size changed or is inaccurate at the time of the
> read, a truncated buffer might result. I have a situation where the file
> exists in a remote location and might actually be a different size
> remotely than locally (due to end-of-line transliterations). This causes
> problems as you might imagine. Anyone have any ideas how to get emacs to
> just read the file?

     Interesting and significant details are missing here, but I'll take 
quick stab at it. . .

     I remember seeing this kind of problem with SMB/LANMAN (the 
Intel/Microsoft file sharing protocol you get with NET USE at the command 
prompt or Map Drive in the Explorer).  Without diving into the source code 
for Emacs, my guess is that the expedient thing would be to

        open the file with Emacs

        copy the file to a scratch directory on your local
        system using some program that cares about EOF, not
        file size (copy, xcopy, cp, whatever - may require some
        experimentation)

        kill the contents of the buffer and insert the contents of
        the copied file from the scratch directory into your buffer

(you could wrap this up into a keyboard macro or lisp function).

     People more knowledgeable than I may have cleaner solutions.  YMMV.

P.S.: I've been fighting this newline vs. CRLF thing (in various forms)
      almost as long as I've used computers.  Everybody (Perl, Samba,
      Cygwin, Emacs, etc.) seems to have a slightly different take on
      it.  Perhaps there should be a sourceforge project to collect best
      practices. . .naaah, nevermind.  Let a thousand flowers bloom.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]