Mercurial > emacs
comparison src/fileio.c @ 25006:c79dc141ef5a
(Fdo_auto_save): Handle the case that echo_area_message
is set.
(Finsert_file_contents): Prevent redisplay optimizations.
(Fread_file_name): Call it.
(report_file_error): Return void.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 21 Jul 1999 21:43:52 +0000 |
parents | 27a1d7a4c444 |
children | 2ad9fa0386b6 |
comparison
equal
deleted
inserted
replaced
25005:95eace73d3ef | 25006:c79dc141ef5a |
---|---|
138 #ifndef HPUX9 | 138 #ifndef HPUX9 |
139 #include <errnet.h> | 139 #include <errnet.h> |
140 #endif | 140 #endif |
141 #endif | 141 #endif |
142 #endif | 142 #endif |
143 | |
144 #include "commands.h" | |
145 extern int use_dialog_box; | |
143 | 146 |
144 #ifndef O_WRONLY | 147 #ifndef O_WRONLY |
145 #define O_WRONLY 1 | 148 #define O_WRONLY 1 |
146 #endif | 149 #endif |
147 | 150 |
3431 | 3434 |
3432 /* Supposedly happens on VMS. */ | 3435 /* Supposedly happens on VMS. */ |
3433 if (! not_regular && st.st_size < 0) | 3436 if (! not_regular && st.st_size < 0) |
3434 error ("File size is negative"); | 3437 error ("File size is negative"); |
3435 | 3438 |
3439 /* Prevent redisplay optimizations. */ | |
3440 current_buffer->clip_changed = 1; | |
3441 | |
3436 if (!NILP (beg) || !NILP (end)) | 3442 if (!NILP (beg) || !NILP (end)) |
3437 if (!NILP (visit)) | 3443 if (!NILP (visit)) |
3438 error ("Attempt to visit less than an entire file"); | 3444 error ("Attempt to visit less than an entire file"); |
3439 | 3445 |
3440 if (!NILP (beg)) | 3446 if (!NILP (beg)) |
5083 { | 5089 { |
5084 struct buffer *old = current_buffer, *b; | 5090 struct buffer *old = current_buffer, *b; |
5085 Lisp_Object tail, buf; | 5091 Lisp_Object tail, buf; |
5086 int auto_saved = 0; | 5092 int auto_saved = 0; |
5087 char *omessage = echo_area_glyphs; | 5093 char *omessage = echo_area_glyphs; |
5094 Lisp_Object omessage_string = echo_area_message; | |
5088 int omessage_length = echo_area_glyphs_length; | 5095 int omessage_length = echo_area_glyphs_length; |
5089 int oldmultibyte = message_enable_multibyte; | 5096 int oldmultibyte = message_enable_multibyte; |
5090 int do_handled_files; | 5097 int do_handled_files; |
5091 Lisp_Object oquit; | 5098 Lisp_Object oquit; |
5092 FILE *stream; | 5099 FILE *stream; |
5093 Lisp_Object lispstream; | 5100 Lisp_Object lispstream; |
5094 int count = specpdl_ptr - specpdl; | 5101 int count = specpdl_ptr - specpdl; |
5095 int *ptr; | 5102 int *ptr; |
5096 int orig_minibuffer_auto_raise = minibuffer_auto_raise; | 5103 int orig_minibuffer_auto_raise = minibuffer_auto_raise; |
5097 | 5104 struct gcpro gcpro1; |
5105 | |
5106 GCPRO1 (omessage_string); | |
5107 | |
5098 /* Ordinarily don't quit within this function, | 5108 /* Ordinarily don't quit within this function, |
5099 but don't make it impossible to quit (in case we get hung in I/O). */ | 5109 but don't make it impossible to quit (in case we get hung in I/O). */ |
5100 oquit = Vquit_flag; | 5110 oquit = Vquit_flag; |
5101 Vquit_flag = Qnil; | 5111 Vquit_flag = Qnil; |
5102 | 5112 |
5236 /* Prevent another auto save till enough input events come in. */ | 5246 /* Prevent another auto save till enough input events come in. */ |
5237 record_auto_save (); | 5247 record_auto_save (); |
5238 | 5248 |
5239 if (auto_saved && NILP (no_message)) | 5249 if (auto_saved && NILP (no_message)) |
5240 { | 5250 { |
5241 if (omessage) | 5251 if (STRINGP (omessage_string)) |
5252 { | |
5253 sit_for (1, 0, 0, 0, 0); | |
5254 message3 (omessage_string, omessage_length, oldmultibyte); | |
5255 } | |
5256 else if (omessage) | |
5242 { | 5257 { |
5243 sit_for (1, 0, 0, 0, 0); | 5258 sit_for (1, 0, 0, 0, 0); |
5244 message2 (omessage, omessage_length, oldmultibyte); | 5259 message2 (omessage, omessage_length, oldmultibyte); |
5245 } | 5260 } |
5246 else | 5261 else |
5247 message1 ("Auto-saving...done"); | 5262 message1 ("Auto-saving...done"); |
5248 } | 5263 } |
5249 | 5264 |
5250 Vquit_flag = oquit; | 5265 Vquit_flag = oquit; |
5251 | 5266 |
5267 UNGCPRO; | |
5252 unbind_to (count, Qnil); | 5268 unbind_to (count, Qnil); |
5253 return Qnil; | 5269 return Qnil; |
5254 } | 5270 } |
5255 | 5271 |
5256 DEFUN ("set-buffer-auto-saved", Fset_buffer_auto_saved, | 5272 DEFUN ("set-buffer-auto-saved", Fset_buffer_auto_saved, |
5483 #endif | 5499 #endif |
5484 | 5500 |
5485 specbind (intern ("minibuffer-completing-file-name"), Qt); | 5501 specbind (intern ("minibuffer-completing-file-name"), Qt); |
5486 | 5502 |
5487 GCPRO2 (insdef, default_filename); | 5503 GCPRO2 (insdef, default_filename); |
5488 val = Fcompleting_read (prompt, intern ("read-file-name-internal"), | 5504 |
5489 dir, mustmatch, insdef, | 5505 #ifdef USE_MOTIF |
5490 Qfile_name_history, default_filename, Qnil); | 5506 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) |
5507 && use_dialog_box | |
5508 && have_menus_p ()) | |
5509 { | |
5510 val = Fx_file_dialog (prompt, dir, default_filename, mustmatch); | |
5511 add_to_history = 1; | |
5512 } | |
5513 else | |
5514 #endif | |
5515 val = Fcompleting_read (prompt, intern ("read-file-name-internal"), | |
5516 dir, mustmatch, insdef, | |
5517 Qfile_name_history, default_filename, Qnil); | |
5491 | 5518 |
5492 tem = Fsymbol_value (Qfile_name_history); | 5519 tem = Fsymbol_value (Qfile_name_history); |
5493 if (CONSP (tem) && EQ (XCONS (tem)->car, val)) | 5520 if (CONSP (tem) && EQ (XCONS (tem)->car, val)) |
5494 replace_in_history = 1; | 5521 replace_in_history = 1; |
5495 | 5522 |
5538 tem = Fsymbol_value (Qfile_name_history); | 5565 tem = Fsymbol_value (Qfile_name_history); |
5539 if (! CONSP (tem) || NILP (Fequal (XCONS (tem)->car, val1))) | 5566 if (! CONSP (tem) || NILP (Fequal (XCONS (tem)->car, val1))) |
5540 Fset (Qfile_name_history, | 5567 Fset (Qfile_name_history, |
5541 Fcons (val1, tem)); | 5568 Fcons (val1, tem)); |
5542 } | 5569 } |
5570 | |
5543 return val; | 5571 return val; |
5544 } | 5572 } |
5573 | |
5545 | 5574 |
5546 void | 5575 void |
5547 init_fileio_once () | 5576 init_fileio_once () |
5548 { | 5577 { |
5549 /* Must be set before any path manipulation is performed. */ | 5578 /* Must be set before any path manipulation is performed. */ |
5550 XSETFASTINT (Vdirectory_sep_char, '/'); | 5579 XSETFASTINT (Vdirectory_sep_char, '/'); |
5551 } | 5580 } |
5552 | 5581 |
5582 | |
5553 void | 5583 void |
5554 syms_of_fileio () | 5584 syms_of_fileio () |
5555 { | 5585 { |
5556 Qexpand_file_name = intern ("expand-file-name"); | 5586 Qexpand_file_name = intern ("expand-file-name"); |
5557 Qsubstitute_in_file_name = intern ("substitute-in-file-name"); | 5587 Qsubstitute_in_file_name = intern ("substitute-in-file-name"); |