aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2015-01-13 15:22:19 -0800
committerPaul Eggert2015-01-13 15:23:03 -0800
commit785adfcc8dee02ac544f80e4f7f8d3d5b2965981 (patch)
tree459b4653c384bd48ea961dbc5da46461a72d90fa
parent564784766297a6f2e06434e2baa7a1d851672a36 (diff)
downloademacs-785adfcc8dee02ac544f80e4f7f8d3d5b2965981.tar.gz
emacs-785adfcc8dee02ac544f80e4f7f8d3d5b2965981.zip
Don't say Fnext_read_file_uses_dialog_p is const
It's const only if a windowing system is not used; don't say it's const otherwise. See: http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00310.html * lib-src/make-docfile.c (write_globals): Add a special hack for Fnext_read_file_uses_dialog_p. * src/fileio.c (next_read_file_uses_dialog_p): Remove. Move guts back to ... (Fnext_read_file_uses_dialog_p): ... here. Don't declare as const, as make-docfile.c now has a special case for this function. This is an ugly hack, but it's better than lying to the compiler.
-rw-r--r--lib-src/ChangeLog6
-rw-r--r--lib-src/make-docfile.c12
-rw-r--r--src/ChangeLog11
-rw-r--r--src/fileio.c30
4 files changed, 39 insertions, 20 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 969aac80124..e9205fdd12a 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,9 @@
12015-01-13 Paul Eggert <eggert@cs.ucla.edu>
2
3 Don't say Fnext_read_file_uses_dialog_p is const
4 * make-docfile.c (write_globals):
5 Add a special hack for Fnext_read_file_uses_dialog_p.
6
12015-01-13 Dmitry Antipov <dmantipov@yandex.ru> 72015-01-13 Dmitry Antipov <dmantipov@yandex.ru>
2 8
3 Support DEFUN attributes. 9 Support DEFUN attributes.
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 79d421a0a8e..741fa4bfa42 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -729,6 +729,18 @@ write_globals (void)
729 729
730 if (globals[i].flags & DEFUN_const) 730 if (globals[i].flags & DEFUN_const)
731 fputs (" ATTRIBUTE_CONST", stdout); 731 fputs (" ATTRIBUTE_CONST", stdout);
732 else if (strcmp (globals[i].name, "Fnext_read_file_uses_dialog_p")
733 == 0)
734 {
735 /* It would be nice to have a cleaner way to deal with this
736 special hack. */
737 fputs (("\n"
738 "#if ! (defined USE_GTK || defined USE_MOTIF \\\n"
739 " || defined HAVE_NS || defined HAVE_NTGUI)\n"
740 "\tATTRIBUTE_CONST\n"
741 "#endif\n"),
742 stdout);
743 }
732 744
733 puts (";"); 745 puts (";");
734 } 746 }
diff --git a/src/ChangeLog b/src/ChangeLog
index 7ec6980bd08..8d05ec13295 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,16 @@
12015-01-13 Paul Eggert <eggert@cs.ucla.edu> 12015-01-13 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 Don't say Fnext_read_file_uses_dialog_p is const
4 It's const only if a windowing system is not used; don't say it's
5 const otherwise. See:
6 http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00310.html
7 * fileio.c (next_read_file_uses_dialog_p): Remove.
8 Move guts back to ...
9 (Fnext_read_file_uses_dialog_p): ... here.
10 Don't declare as const, as make-docfile.c now has a special case
11 for this function. This is an ugly hack, but it's better than
12 lying to the compiler.
13
3 Remove now-unnecessary forward XTYPE decl 14 Remove now-unnecessary forward XTYPE decl
4 * lisp.h (XTYPE): Remove forward declaration. The recent merge 15 * lisp.h (XTYPE): Remove forward declaration. The recent merge
5 from emacs-24 fixed the problem in a better way, by moving XPNTR's 16 from emacs-24 fixed the problem in a better way, by moving XPNTR's
diff --git a/src/fileio.c b/src/fileio.c
index 45a31c0e573..6c443c91db7 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -5734,34 +5734,24 @@ then any auto-save counts as "recent". */)
5734 return (SAVE_MODIFF < BUF_AUTOSAVE_MODIFF (current_buffer) ? Qt : Qnil); 5734 return (SAVE_MODIFF < BUF_AUTOSAVE_MODIFF (current_buffer) ? Qt : Qnil);
5735} 5735}
5736 5736
5737/* We want Fnext_read_file_uses_dialog_p to have ATTRIBUTE_CONST
5738 regardless of #ifdefs, so there is a trivial workaround. See
5739 http://lists.gnu.org/archive/html/emacs-devel/2015-01/msg00289.html. */
5740
5741static bool
5742next_read_file_uses_dialog_p (void)
5743{
5744#if defined (USE_MOTIF) || defined (HAVE_NTGUI) || defined (USE_GTK) \
5745 || defined (HAVE_NS)
5746 return ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
5747 && use_dialog_box
5748 && use_file_dialog
5749 && window_system_available (SELECTED_FRAME ()));
5750#endif
5751 return false;
5752}
5753
5754/* Reading and completing file names. */ 5737/* Reading and completing file names. */
5755 5738
5756DEFUN ("next-read-file-uses-dialog-p", Fnext_read_file_uses_dialog_p, 5739DEFUN ("next-read-file-uses-dialog-p", Fnext_read_file_uses_dialog_p,
5757 Snext_read_file_uses_dialog_p, 0, 0, 0, 5740 Snext_read_file_uses_dialog_p, 0, 0, 0,
5758 doc: /* Return t if a call to `read-file-name' will use a dialog. 5741 doc: /* Return t if a call to `read-file-name' will use a dialog.
5759The return value is only relevant for a call to `read-file-name' that happens 5742The return value is only relevant for a call to `read-file-name' that happens
5760before any other event (mouse or keypress) is handled. */ 5743before any other event (mouse or keypress) is handled. */)
5761 attributes: const)
5762 (void) 5744 (void)
5763{ 5745{
5764 return next_read_file_uses_dialog_p () ? Qt : Qnil; 5746#if (defined USE_GTK || defined USE_MOTIF \
5747 || defined HAVE_NS || defined HAVE_NTGUI)
5748 if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
5749 && use_dialog_box
5750 && use_file_dialog
5751 && window_system_available (SELECTED_FRAME ()))
5752 return Qt;
5753#endif
5754 return Qnil;
5765} 5755}
5766 5756
5767void 5757void