Commit 4c95c9a5 authored by Paul Eggert's avatar Paul Eggert
Browse files

* fileio.c (Finsert_file_contents): Don't put tail into head area,

as that confuses set-auto-coding, so insist on the head-read
returning the full 1024 bytes.  Let lseek compute the tail offset;
less work for us.  Do not ignore I/O errors when reading the tail.
parent ce0440ff
2012-12-13 Paul Eggert <eggert@cs.ucla.edu>
 
* fileio.c (Finsert_file_contents): Don't put tail into head area,
as that confuses set-auto-coding, so insist on the head-read
returning the full 1024 bytes. Let lseek compute the tail offset;
less work for us. Do not ignore I/O errors when reading the tail.
* xdisp.c: Minor style fixes.
(init_iterator): Hoist assignment out of if-expression.
(markpos_of_region): Callers now test for sign, not for -1.
......
......@@ -3487,12 +3487,14 @@ variable `last-coding-system-used' to the coding system actually used. */)
else
{
nread = emacs_read (fd, read_buf, 1024);
if (nread >= 0)
if (nread == 1024)
{
if (lseek (fd, st.st_size - (1024 * 3), SEEK_SET) < 0)
int ntail;
if (lseek (fd, - (1024 * 3), SEEK_END) < 0)
report_file_error ("Setting file position",
Fcons (orig_filename, Qnil));
nread += emacs_read (fd, read_buf + nread, 1024 * 3);
ntail = emacs_read (fd, read_buf + nread, 1024 * 3);
nread = ntail < 0 ? ntail : nread + ntail;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment