From: Dmitry Antipov Date: Tue, 13 Jan 2015 10:08:32 +0000 (+0300) Subject: Make Fnext_read_file_uses_dialog_p compatible with recent DEFUN change. X-Git-Tag: emacs-25.0.90~2603^2~18 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0064e36f4fc76b0e8d2fc8d3e6f63da6e579a414;p=emacs.git Make Fnext_read_file_uses_dialog_p compatible with recent DEFUN change. * fileio.c (next_read_file_uses_dialog_p): New workaround ... (Fnext_read_file_uses_dialog_p): ... called from here to avoid ATTRIBUTE_CONST dependency from #ifdefs. For details, see http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00289.html. --- diff --git a/src/ChangeLog b/src/ChangeLog index 00068d4330c..81d6772bc23 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -32,6 +32,11 @@ (fast_string_match_internal): Add prototype. * dired.c (file_name_completion): Use fast_string_match_internal. + * fileio.c (next_read_file_uses_dialog_p): New workaround ... + (Fnext_read_file_uses_dialog_p): ... called from here to avoid + ATTRIBUTE_CONST dependency from #ifdefs. For details, see + http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00289.html. + 2015-01-12 Paul Eggert Port to 32-bit MingGW --with-wide-int diff --git a/src/fileio.c b/src/fileio.c index cd3c485da0f..45a31c0e573 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -5733,25 +5733,35 @@ then any auto-save counts as "recent". */) they're never autosaved. */ return (SAVE_MODIFF < BUF_AUTOSAVE_MODIFF (current_buffer) ? Qt : Qnil); } - -/* Reading and completing file names */ + +/* We want Fnext_read_file_uses_dialog_p to have ATTRIBUTE_CONST + regardless of #ifdefs, so there is a trivial workaround. See + http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00289.html. */ + +static bool +next_read_file_uses_dialog_p (void) +{ +#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) \ + || defined (HAVE_NS) + return ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) + && use_dialog_box + && use_file_dialog + && window_system_available (SELECTED_FRAME ())); +#endif + return false; +} + +/* Reading and completing file names. */ 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 handled. */) +before any other event (mouse or keypress) is handled. */ + attributes: const) (void) { -#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) \ - || defined (HAVE_NS) - if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event)) - && use_dialog_box - && use_file_dialog - && window_system_available (SELECTED_FRAME ())) - return Qt; -#endif - return Qnil; + return next_read_file_uses_dialog_p () ? Qt : Qnil; } void