changeset 57942:3a6cc929df05

* fileio.c (Fnext_read_file_uses_dialog_p): New function.
author Jan Djärv <jan.h.d@swipnet.se>
date Thu, 04 Nov 2004 15:19:49 +0000
parents 68ea73fe257b
children e4c39a455af0
files src/ChangeLog src/fileio.c
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Nov 04 15:05:27 2004 +0000
+++ b/src/ChangeLog	Thu Nov 04 15:19:49 2004 +0000
@@ -1,5 +1,7 @@
 2004-11-04  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
 
+	* fileio.c (Fnext_read_file_uses_dialog_p): New function.
+
 	* gtkutil.h: Declare use_old_gtk_file_dialog.
 
 	* gtkutil.c: Make use_old_gtk_file_dialog non-static.
--- a/src/fileio.c	Thu Nov 04 15:05:27 2004 +0000
+++ b/src/fileio.c	Thu Nov 04 15:19:49 2004 +0000
@@ -6174,6 +6174,23 @@
   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.
@@ -6306,10 +6323,7 @@
   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;
@@ -6694,6 +6708,7 @@
 
   defsubr (&Sread_file_name_internal);
   defsubr (&Sread_file_name);
+  defsubr (&Snext_read_file_uses_dialog_p);
 
 #ifdef unix
   defsubr (&Sunix_sync);