- /* Display them in a menu. */
-
- /* FIXME: Use a terminal hook! */
-#if defined HAVE_NTGUI
- if (FRAME_W32_P (f))
- selection = w32_menu_show (f, xpos, ypos, for_click,
- keymaps, title, &error_name);
- else
-#endif
-#if defined HAVE_NS
- if (FRAME_NS_P (f))
- selection = ns_menu_show (f, xpos, ypos, for_click,
- keymaps, title, &error_name);
- else
-#endif
-#if (defined (HAVE_X_WINDOWS) || defined (MSDOS))
- if (FRAME_X_P (f) || FRAME_MSDOS_P (f))
- selection = xmenu_show (f, xpos, ypos, for_click,
- keymaps, title, &error_name);
- else
-#endif
- if (FRAME_TERMCAP_P (f))
- {
- ptrdiff_t count1 = SPECPDL_INDEX ();
-
- /* Avoid crashes if, e.g., another client will connect while we
- are in a menu. */
- temporarily_switch_to_single_kboard (f);
- selection = tty_menu_show (f, xpos, ypos, for_click, keymaps, title,
- kbd_menu_navigation, &error_name);
- unbind_to (count1, Qnil);
- }
+ /* Display them in a menu, but not if F is the initial frame that
+ doesn't have its hooks set (e.g., in a batch session), because
+ such a frame cannot display menus. */
+ if (!FRAME_INITIAL_P (f))
+ selection = FRAME_TERMINAL (f)->menu_show_hook (f, xpos, ypos, menuflags,
+ title, &error_name);