Mercurial > hg > xemacs-beta
comparison src/fileio.c @ 259:11cf20601dec r20-5b28
Import from CVS: tag r20-5b28
author | cvs |
---|---|
date | Mon, 13 Aug 2007 10:23:02 +0200 |
parents | 677f6a0ee643 |
children | 727739f917cb |
comparison
equal
deleted
inserted
replaced
258:58424f6abf56 | 259:11cf20601dec |
---|---|
31 #include "insdel.h" | 31 #include "insdel.h" |
32 #include "lstream.h" | 32 #include "lstream.h" |
33 #include "redisplay.h" | 33 #include "redisplay.h" |
34 #include "sysdep.h" | 34 #include "sysdep.h" |
35 #include "window.h" /* minibuf_level */ | 35 #include "window.h" /* minibuf_level */ |
36 #ifdef MULE | 36 #ifdef FILE_CODING |
37 #include "mule-coding.h" | 37 #include "file-coding.h" |
38 #endif | 38 #endif |
39 | 39 |
40 #ifdef HAVE_LIBGEN_H /* Must come before sysfile.h */ | 40 #ifdef HAVE_LIBGEN_H /* Must come before sysfile.h */ |
41 #include <libgen.h> | 41 #include <libgen.h> |
42 #endif | 42 #endif |
2758 val = call6 (handler, Qinsert_file_contents, filename, | 2758 val = call6 (handler, Qinsert_file_contents, filename, |
2759 visit, beg, end, replace); | 2759 visit, beg, end, replace); |
2760 goto handled; | 2760 goto handled; |
2761 } | 2761 } |
2762 | 2762 |
2763 #ifdef MULE | 2763 #ifdef FILE_CODING |
2764 if (!NILP (used_codesys)) | 2764 if (!NILP (used_codesys)) |
2765 CHECK_SYMBOL (used_codesys); | 2765 CHECK_SYMBOL (used_codesys); |
2766 #endif | 2766 #endif |
2767 | 2767 |
2768 if ( (!NILP (beg) || !NILP (end)) && !NILP (visit) ) | 2768 if ( (!NILP (beg) || !NILP (end)) && !NILP (visit) ) |
2859 | 2859 |
2860 /* If requested, replace the accessible part of the buffer | 2860 /* If requested, replace the accessible part of the buffer |
2861 with the file contents. Avoid replacing text at the | 2861 with the file contents. Avoid replacing text at the |
2862 beginning or end of the buffer that matches the file contents; | 2862 beginning or end of the buffer that matches the file contents; |
2863 that preserves markers pointing to the unchanged parts. */ | 2863 that preserves markers pointing to the unchanged parts. */ |
2864 #if !defined (MULE) | 2864 #if !defined (FILE_CODING) |
2865 /* The replace-mode code currently only works when the assumption | 2865 /* The replace-mode code currently only works when the assumption |
2866 'one byte == one char' holds true. This fails Mule because | 2866 'one byte == one char' holds true. This fails Mule because |
2867 files may contain multibyte characters. It holds under Windows NT | 2867 files may contain multibyte characters. It holds under Windows NT |
2868 provided we convert CRLF into LF. */ | 2868 provided we convert CRLF into LF. */ |
2869 # define FSFMACS_SPEEDY_INSERT | 2869 # define FSFMACS_SPEEDY_INSERT |
3162 Lisp_Object stream = make_filedesc_input_stream (fd, 0, total, | 3162 Lisp_Object stream = make_filedesc_input_stream (fd, 0, total, |
3163 LSTR_ALLOW_QUIT); | 3163 LSTR_ALLOW_QUIT); |
3164 | 3164 |
3165 NGCPRO1 (stream); | 3165 NGCPRO1 (stream); |
3166 Lstream_set_buffering (XLSTREAM (stream), LSTREAM_BLOCKN_BUFFERED, 65536); | 3166 Lstream_set_buffering (XLSTREAM (stream), LSTREAM_BLOCKN_BUFFERED, 65536); |
3167 #ifdef MULE | 3167 #ifdef FILE_CODING |
3168 stream = make_decoding_input_stream | 3168 stream = make_decoding_input_stream |
3169 (XLSTREAM (stream), Fget_coding_system (codesys)); | 3169 (XLSTREAM (stream), Fget_coding_system (codesys)); |
3170 Lstream_set_character_mode (XLSTREAM (stream)); | 3170 Lstream_set_character_mode (XLSTREAM (stream)); |
3171 Lstream_set_buffering (XLSTREAM (stream), LSTREAM_BLOCKN_BUFFERED, 65536); | 3171 Lstream_set_buffering (XLSTREAM (stream), LSTREAM_BLOCKN_BUFFERED, 65536); |
3172 #endif /* MULE */ | 3172 #endif /* MULE */ |
3276 !NILP (visit) | 3276 !NILP (visit) |
3277 ? INSDEL_NO_LOCKING : 0); | 3277 ? INSDEL_NO_LOCKING : 0); |
3278 inserted += cc_inserted; | 3278 inserted += cc_inserted; |
3279 cur_point += cc_inserted; | 3279 cur_point += cc_inserted; |
3280 } | 3280 } |
3281 #ifdef MULE | 3281 #ifdef FILE_CODING |
3282 if (!NILP (used_codesys)) | 3282 if (!NILP (used_codesys)) |
3283 { | 3283 { |
3284 Fset (used_codesys, | 3284 Fset (used_codesys, |
3285 XCODING_SYSTEM_NAME (decoding_stream_coding_system (XLSTREAM (stream)))); | 3285 XCODING_SYSTEM_NAME (decoding_stream_coding_system (XLSTREAM (stream)))); |
3286 } | 3286 } |
3436 #ifdef DOS_NT | 3436 #ifdef DOS_NT |
3437 int buffer_file_type | 3437 int buffer_file_type |
3438 = NILP (current_buffer->buffer_file_type) ? O_TEXT : O_BINARY; | 3438 = NILP (current_buffer->buffer_file_type) ? O_TEXT : O_BINARY; |
3439 #endif /* DOS_NT */ | 3439 #endif /* DOS_NT */ |
3440 | 3440 |
3441 #ifdef MULE | 3441 #ifdef FILE_CODING |
3442 codesys = Fget_coding_system (codesys); | 3442 codesys = Fget_coding_system (codesys); |
3443 #endif /* MULE */ | 3443 #endif /* MULE */ |
3444 | 3444 |
3445 if (current_buffer->base_buffer && ! NILP (visit)) | 3445 if (current_buffer->base_buffer && ! NILP (visit)) |
3446 error ("Cannot do file visiting in an indirect buffer"); | 3446 error ("Cannot do file visiting in an indirect buffer"); |
3585 for each request. So I've increased the buffer size | 3585 for each request. So I've increased the buffer size |
3586 to 64K.) */ | 3586 to 64K.) */ |
3587 outstream = make_filedesc_output_stream (desc, 0, -1, 0); | 3587 outstream = make_filedesc_output_stream (desc, 0, -1, 0); |
3588 Lstream_set_buffering (XLSTREAM (outstream), | 3588 Lstream_set_buffering (XLSTREAM (outstream), |
3589 LSTREAM_BLOCKN_BUFFERED, 65536); | 3589 LSTREAM_BLOCKN_BUFFERED, 65536); |
3590 #ifdef MULE | 3590 #ifdef FILE_CODING |
3591 outstream = | 3591 outstream = |
3592 make_encoding_output_stream (XLSTREAM (outstream), codesys); | 3592 make_encoding_output_stream (XLSTREAM (outstream), codesys); |
3593 Lstream_set_buffering (XLSTREAM (outstream), | 3593 Lstream_set_buffering (XLSTREAM (outstream), |
3594 LSTREAM_BLOCKN_BUFFERED, 65536); | 3594 LSTREAM_BLOCKN_BUFFERED, 65536); |
3595 #endif /* MULE */ | 3595 #endif /* MULE */ |
4306 the special file that lists them. For each of | 4306 the special file that lists them. For each of |
4307 these buffers, record visited name (if any) and | 4307 these buffers, record visited name (if any) and |
4308 auto save name. */ | 4308 auto save name. */ |
4309 if (listdesc >= 0) | 4309 if (listdesc >= 0) |
4310 { | 4310 { |
4311 Extbyte *auto_save_file_name_ext; | 4311 CONST Extbyte *auto_save_file_name_ext; |
4312 Extcount auto_save_file_name_ext_len; | 4312 Extcount auto_save_file_name_ext_len; |
4313 | 4313 |
4314 GET_STRING_FILENAME_DATA_ALLOCA | 4314 GET_STRING_FILENAME_DATA_ALLOCA |
4315 (b->auto_save_file_name, | 4315 (b->auto_save_file_name, |
4316 auto_save_file_name_ext, | 4316 auto_save_file_name_ext, |
4317 auto_save_file_name_ext_len); | 4317 auto_save_file_name_ext_len); |
4318 if (!NILP (b->filename)) | 4318 if (!NILP (b->filename)) |
4319 { | 4319 { |
4320 Extbyte *filename_ext; | 4320 CONST Extbyte *filename_ext; |
4321 Extcount filename_ext_len; | 4321 Extcount filename_ext_len; |
4322 | 4322 |
4323 GET_STRING_FILENAME_DATA_ALLOCA (b->filename, | 4323 GET_STRING_FILENAME_DATA_ALLOCA (b->filename, |
4324 filename_ext, | 4324 filename_ext, |
4325 filename_ext_len); | 4325 filename_ext_len); |