3371 |
} |
} |
3372 |
|
|
3373 |
DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, |
DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0, |
3374 |
doc: /* Return mode bits of file named FILENAME, as an integer. */) |
doc: /* Return mode bits of file named FILENAME, as an integer. |
3375 |
|
Return nil, if file does not exist or is not accessible. */) |
3376 |
(filename) |
(filename) |
3377 |
Lisp_Object filename; |
Lisp_Object filename; |
3378 |
{ |
{ |
5629 |
auto_save_1 () |
auto_save_1 () |
5630 |
{ |
{ |
5631 |
struct stat st; |
struct stat st; |
5632 |
|
Lisp_Object modes; |
5633 |
|
|
5634 |
|
auto_save_mode_bits = 0666; |
5635 |
|
|
5636 |
/* Get visited file's mode to become the auto save file's mode. */ |
/* Get visited file's mode to become the auto save file's mode. */ |
5637 |
if (! NILP (current_buffer->filename) |
if (! NILP (current_buffer->filename)) |
5638 |
&& stat (SDATA (current_buffer->filename), &st) >= 0) |
{ |
5639 |
/* But make sure we can overwrite it later! */ |
if (stat (SDATA (current_buffer->filename), &st) >= 0) |
5640 |
auto_save_mode_bits = st.st_mode | 0600; |
/* But make sure we can overwrite it later! */ |
5641 |
else if (! NILP (current_buffer->filename)) |
auto_save_mode_bits = st.st_mode | 0600; |
5642 |
/* Remote files don't cooperate with stat. */ |
else if ((modes = Ffile_modes (current_buffer->filename), |
5643 |
auto_save_mode_bits = XINT (Ffile_modes (current_buffer->filename)) | 0600; |
INTEGERP (modes))) |
5644 |
else |
/* Remote files don't cooperate with stat. */ |
5645 |
auto_save_mode_bits = 0666; |
auto_save_mode_bits = XINT (modes) | 0600; |
5646 |
|
} |
5647 |
|
|
5648 |
return |
return |
5649 |
Fwrite_region (Qnil, Qnil, |
Fwrite_region (Qnil, Qnil, |
6095 |
return Ffile_exists_p (string); |
return Ffile_exists_p (string); |
6096 |
} |
} |
6097 |
|
|
6098 |
|
DEFUN ("next-read-file-uses-dialog-p", Fnext_read_file_uses_dialog_p, |
6099 |
|
Snext_read_file_uses_dialog_p, 0, 0, 0, |
6100 |
|
doc: /* Return t if a call to `read-file-name' will use a dialog. |
6101 |
|
The return value is only relevant for a call to `read-file-name' that happens |
6102 |
|
before any other event (mouse or keypress) is handeled. */) |
6103 |
|
() |
6104 |
|
{ |
6105 |
|
#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON) |
6106 |
|
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) |
6107 |
|
&& use_dialog_box |
6108 |
|
&& use_file_dialog |
6109 |
|
&& have_menus_p ()) |
6110 |
|
return Qt; |
6111 |
|
#endif |
6112 |
|
return Qnil; |
6113 |
|
} |
6114 |
|
|
6115 |
DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0, |
DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0, |
6116 |
doc: /* Read file name, prompting with PROMPT and completing in directory DIR. |
doc: /* Read file name, prompting with PROMPT and completing in directory DIR. |
6117 |
Value is not expanded---you must call `expand-file-name' yourself. |
Value is not expanded---you must call `expand-file-name' yourself. |
6244 |
GCPRO2 (insdef, default_filename); |
GCPRO2 (insdef, default_filename); |
6245 |
|
|
6246 |
#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON) |
#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON) |
6247 |
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) |
if (! NILP (Fnext_read_file_uses_dialog_p ())) |
|
&& use_dialog_box |
|
|
&& use_file_dialog |
|
|
&& have_menus_p ()) |
|
6248 |
{ |
{ |
6249 |
/* If DIR contains a file name, split it. */ |
/* If DIR contains a file name, split it. */ |
6250 |
Lisp_Object file; |
Lisp_Object file; |
6629 |
|
|
6630 |
defsubr (&Sread_file_name_internal); |
defsubr (&Sread_file_name_internal); |
6631 |
defsubr (&Sread_file_name); |
defsubr (&Sread_file_name); |
6632 |
|
defsubr (&Snext_read_file_uses_dialog_p); |
6633 |
|
|
6634 |
#ifdef unix |
#ifdef unix |
6635 |
defsubr (&Sunix_sync); |
defsubr (&Sunix_sync); |