comparison src/fileio.c @ 49191:9b836b1dabe5

(syms_of_fileio) <directory-sep-char>: Doc fix. (Fdo_auto_save): Add gcpros around Ffile_name_directory.
author Richard M. Stallman <rms@gnu.org>
date Mon, 13 Jan 2003 08:17:33 +0000
parents 0b4aeb4594ad
children 0064f690e77d
comparison
equal deleted inserted replaced
49190:bcb627207749 49191:9b836b1dabe5
3261 call the corresponding file handler. */ 3261 call the corresponding file handler. */
3262 handler = Ffind_file_name_handler (filename, Qfile_accessible_directory_p); 3262 handler = Ffind_file_name_handler (filename, Qfile_accessible_directory_p);
3263 if (!NILP (handler)) 3263 if (!NILP (handler))
3264 return call2 (handler, Qfile_accessible_directory_p, filename); 3264 return call2 (handler, Qfile_accessible_directory_p, filename);
3265 3265
3266 /* It's an unlikely combination, but yes we really do need to gcpro:
3267 Suppose that file-accessible-directory-p has no handler, but
3268 file-directory-p does have a handler; this handler causes a GC which
3269 relocates the string in `filename'; and finally file-directory-p
3270 returns non-nil. Then we would end up passing a garbaged string
3271 to file-executable-p. */
3272 GCPRO1 (filename); 3266 GCPRO1 (filename);
3273 tem = (NILP (Ffile_directory_p (filename)) 3267 tem = (NILP (Ffile_directory_p (filename))
3274 || NILP (Ffile_executable_p (filename))); 3268 || NILP (Ffile_executable_p (filename)));
3275 UNGCPRO; 3269 UNGCPRO;
3276 return tem ? Qnil : Qt; 3270 return tem ? Qnil : Qt;
5615 FILE *stream; 5609 FILE *stream;
5616 Lisp_Object lispstream; 5610 Lisp_Object lispstream;
5617 int count = SPECPDL_INDEX (); 5611 int count = SPECPDL_INDEX ();
5618 int orig_minibuffer_auto_raise = minibuffer_auto_raise; 5612 int orig_minibuffer_auto_raise = minibuffer_auto_raise;
5619 int old_message_p = 0; 5613 int old_message_p = 0;
5614 struct gcpro gcpro1, gcpro2;
5620 5615
5621 if (max_specpdl_size < specpdl_size + 40) 5616 if (max_specpdl_size < specpdl_size + 40)
5622 max_specpdl_size = specpdl_size + 40; 5617 max_specpdl_size = specpdl_size + 40;
5623 5618
5624 if (minibuf_level) 5619 if (minibuf_level)
5651 because creating the directory might signal an error, and 5646 because creating the directory might signal an error, and
5652 that would leave Emacs in a strange state. */ 5647 that would leave Emacs in a strange state. */
5653 if (!NILP (Vrun_hooks)) 5648 if (!NILP (Vrun_hooks))
5654 { 5649 {
5655 Lisp_Object dir; 5650 Lisp_Object dir;
5651 dir = Qnil;
5652 GCPRO2 (dir, listfile);
5656 dir = Ffile_name_directory (listfile); 5653 dir = Ffile_name_directory (listfile);
5657 if (NILP (Ffile_directory_p (dir))) 5654 if (NILP (Ffile_directory_p (dir)))
5658 internal_condition_case_1 (do_auto_save_make_dir, 5655 internal_condition_case_1 (do_auto_save_make_dir,
5659 dir, Fcons (Fcons (Qfile_error, Qnil), Qnil), 5656 dir, Fcons (Fcons (Qfile_error, Qnil), Qnil),
5660 do_auto_save_eh); 5657 do_auto_save_eh);
5658 UNGCPRO;
5661 } 5659 }
5662 5660
5663 stream = fopen (SDATA (listfile), "w"); 5661 stream = fopen (SDATA (listfile), "w");
5664 if (stream != NULL) 5662 if (stream != NULL)
5665 { 5663 {
6351 nil means use format `var'. This variable is meaningful only on VMS. */); 6349 nil means use format `var'. This variable is meaningful only on VMS. */);
6352 vms_stmlf_recfm = 0; 6350 vms_stmlf_recfm = 0;
6353 6351
6354 DEFVAR_LISP ("directory-sep-char", &Vdirectory_sep_char, 6352 DEFVAR_LISP ("directory-sep-char", &Vdirectory_sep_char,
6355 doc: /* Directory separator character for built-in functions that return file names. 6353 doc: /* Directory separator character for built-in functions that return file names.
6356 The value should be either ?/ or ?\\ (any other value is treated as ?\\). 6354 The value is always ?/. Don't use this variable, just use `/'. */);
6357 This variable affects the built-in functions only on Windows,
6358 on other platforms, it is initialized so that Lisp code can find out
6359 what the normal separator is. */);
6360 6355
6361 DEFVAR_LISP ("file-name-handler-alist", &Vfile_name_handler_alist, 6356 DEFVAR_LISP ("file-name-handler-alist", &Vfile_name_handler_alist,
6362 doc: /* *Alist of elements (REGEXP . HANDLER) for file names handled specially. 6357 doc: /* *Alist of elements (REGEXP . HANDLER) for file names handled specially.
6363 If a file name matches REGEXP, then all I/O on that file is done by calling 6358 If a file name matches REGEXP, then all I/O on that file is done by calling
6364 HANDLER. 6359 HANDLER.