aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorKaroly Lorentey <[email protected]>2004-11-06 17:52:02 +0000
committerKaroly Lorentey <[email protected]>2004-11-06 17:52:02 +0000
commit65ea79492334e2ef7b5b4e0d23b6f68ba2f4d0bb (patch)
tree853cf391ca1abda4f4ccd6fe8e7bb43f7c86ee08 /src/fileio.c
parente0bc17abe6979d607e8de4684dddb96e53c60065 (diff)
parent392cf16dd0ee9358f8af0cd0d8048b822456bbeb (diff)
Merged in changes from CVS trunk.
Patches applied: * [email protected]/emacs--cvs-trunk--0--patch-653 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-654 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-655 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-656 Update from CVS: lisp/man.el (Man-xref-normal-file): Fix help-echo. * [email protected]/emacs--cvs-trunk--0--patch-657 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-658 Merge from gnus--rel--5.10 * [email protected]/emacs--cvs-trunk--0--patch-659 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-660 Merge from gnus--rel--5.10 * [email protected]/emacs--cvs-trunk--0--patch-661 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-662 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-663 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-664 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-665 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-666 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-667 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-668 Merge from gnus--rel--5.10 * [email protected]/emacs--cvs-trunk--0--patch-669 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-670 Update from CVS * [email protected]/emacs--cvs-trunk--0--patch-671 Update from CVS * [email protected]/gnus--rel--5.10--patch-64 Update from CVS * [email protected]/gnus--rel--5.10--patch-65 Update from CVS * [email protected]/gnus--rel--5.10--patch-66 Update from CVS * [email protected]/gnus--rel--5.10--patch-67 Update from CVS * [email protected]/gnus--rel--5.10--patch-68 Update from CVS git-archimport-id: [email protected]/emacs--multi-tty--0--patch-264
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/src/fileio.c b/src/fileio.c
index ece909ea8b..587f36d537 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3368,7 +3368,8 @@ This is the sort of file that holds an ordinary stream of data bytes. */)
}
DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
- doc: /* Return mode bits of file named FILENAME, as an integer. */)
+ doc: /* Return mode bits of file named FILENAME, as an integer.
+Return nil, if file does not exist or is not accessible. */)
(filename)
Lisp_Object filename;
{
@@ -5714,17 +5715,21 @@ Lisp_Object
auto_save_1 ()
{
struct stat st;
+ Lisp_Object modes;
+
+ auto_save_mode_bits = 0666;
/* Get visited file's mode to become the auto save file's mode. */
- if (! NILP (current_buffer->filename)
- && stat (SDATA (current_buffer->filename), &st) >= 0)
- /* But make sure we can overwrite it later! */
- auto_save_mode_bits = st.st_mode | 0600;
- else if (! NILP (current_buffer->filename))
- /* Remote files don't cooperate with stat. */
- auto_save_mode_bits = XINT (Ffile_modes (current_buffer->filename)) | 0600;
- else
- auto_save_mode_bits = 0666;
+ if (! NILP (current_buffer->filename))
+ {
+ if (stat (SDATA (current_buffer->filename), &st) >= 0)
+ /* But make sure we can overwrite it later! */
+ auto_save_mode_bits = st.st_mode | 0600;
+ else if ((modes = Ffile_modes (current_buffer->filename),
+ INTEGERP (modes)))
+ /* Remote files don't cooperate with stat. */
+ auto_save_mode_bits = XINT (modes) | 0600;
+ }
return
Fwrite_region (Qnil, Qnil,
@@ -6176,6 +6181,23 @@ DEFUN ("read-file-name-internal", Fread_file_name_internal, Sread_file_name_inte
return Ffile_exists_p (string);
}
+DEFUN ("next-read-file-uses-dialog-p", Fnext_read_file_uses_dialog_p,
+ Snext_read_file_uses_dialog_p, 0, 0, 0,
+ doc: /* Return t if a call to `read-file-name' will use a dialog.
+The return value is only relevant for a call to `read-file-name' that happens
+before any other event (mouse or keypress) is handeled. */)
+ ()
+{
+#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON)
+ if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
+ && use_dialog_box
+ && use_file_dialog
+ && have_menus_p ())
+ return Qt;
+#endif
+ return Qnil;
+}
+
DEFUN ("read-file-name", Fread_file_name, Sread_file_name, 1, 6, 0,
doc: /* Read file name, prompting with PROMPT and completing in directory DIR.
Value is not expanded---you must call `expand-file-name' yourself.
@@ -6308,10 +6330,7 @@ and `read-file-name-function'. */)
GCPRO2 (insdef, default_filename);
#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) || defined (TARGET_API_MAC_CARBON)
- if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
- && use_dialog_box
- && use_file_dialog
- && have_menus_p ())
+ if (! NILP (Fnext_read_file_uses_dialog_p ()))
{
/* If DIR contains a file name, split it. */
Lisp_Object file;
@@ -6323,7 +6342,8 @@ and `read-file-name-function'. */)
}
if (!NILP(default_filename))
default_filename = Fexpand_file_name (default_filename, dir);
- val = Fx_file_dialog (prompt, dir, default_filename, mustmatch);
+ val = Fx_file_dialog (prompt, dir, default_filename, mustmatch,
+ EQ (predicate, Qfile_directory_p) ? Qt : Qnil);
add_to_history = 1;
}
else
@@ -6695,6 +6715,7 @@ a non-nil value. */);
defsubr (&Sread_file_name_internal);
defsubr (&Sread_file_name);
+ defsubr (&Snext_read_file_uses_dialog_p);
#ifdef unix
defsubr (&Sunix_sync);