Prefer list1 (X) to Fcons (X, Qnil) when building lists.
[bpt/emacs.git] / src / xmenu.c
index 57cf27f..8349b0d 100644 (file)
@@ -223,8 +223,6 @@ for instance using the window manager, then this produces a quit and
   FRAME_PTR f = NULL;
   Lisp_Object window;
 
-  check_x ();
-
   /* Decode the first argument: find the window or frame to use.  */
   if (EQ (position, Qt)
       || (CONSP (position) && (EQ (XCAR (position), Qmenu_bar)
@@ -277,8 +275,7 @@ for instance using the window manager, then this produces a quit and
        but I don't want to make one now.  */
     CHECK_WINDOW (window);
 
-  if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f))
-    error ("Can not put X dialog on this terminal");
+  check_window_system (f);
 
   /* Force a redisplay before showing the dialog.  If a frame is created
      just before showing the dialog, its contents may not have been fully
@@ -299,10 +296,10 @@ for instance using the window manager, then this produces a quit and
     XSETFRAME (frame, f);
     XSETINT (x, x_pixel_width (f) / 2);
     XSETINT (y, x_pixel_height (f) / 2);
-    newpos = Fcons (Fcons (x, Fcons (y, Qnil)), Fcons (frame, Qnil));
+    newpos = list2 (list2 (x, y), frame);
 
     return Fx_popup_menu (newpos,
-                         Fcons (Fcar (contents), Fcons (contents, Qnil)));
+                         list2 (Fcar (contents), contents));
   }
 #else
   {
@@ -320,9 +317,9 @@ for instance using the window manager, then this produces a quit and
       /* No buttons specified, add an "Ok" button so users can pop down
          the dialog.  Also, the lesstif/motif version crashes if there are
          no buttons.  */
-      contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil));
+      contents = list2 (title, Fcons (build_string ("Ok"), Qt));
 
-    list_of_panes (Fcons (contents, Qnil));
+    list_of_panes (list1 (contents));
 
     /* Display them in a dialog box.  */
     block_input ();
@@ -400,7 +397,7 @@ x_menu_wait_for_event (void *data)
       else
         ntp = &next_time;
 
-#ifdef HAVE_GTK3
+#if defined USE_GTK && defined HAVE_GTK3
       /* Gtk3 have arrows on menus when they don't fit.  When the
         pointer is over an arrow, a timeout scrolls it a bit.  Use
         xg_select so that timeout gets triggered.  */
@@ -485,7 +482,7 @@ If FRAME is nil or not given, use the selected frame.  */)
   (Lisp_Object frame)
 {
   XEvent ev;
-  FRAME_PTR f = check_x_frame (frame);
+  FRAME_PTR f = decode_window_system_frame (frame);
   Widget menubar;
   block_input ();
 
@@ -569,7 +566,7 @@ If FRAME is nil or not given, use the selected frame.  */)
      block_input ().  */
 
   block_input ();
-  f = check_x_frame (frame);
+  f = decode_window_system_frame (frame);
 
   if (FRAME_EXTERNAL_MENU_BAR (f))
     set_frame_menubar (f, 0, 1);
@@ -976,7 +973,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
       if (! menubar_widget)
        previous_menu_items_used = 0;
 
-      buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer;
+      buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->contents;
       specbind (Qinhibit_quit, Qt);
       /* Don't let the debugger step into this code
         because it is not reentrant.  */
@@ -1055,7 +1052,7 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
       wv->help = Qnil;
       first_wv = wv;
 
-      for (i = 0; 0 <= submenu_start[i]; i++)
+      for (i = 0; submenu_start[i] >= 0; i++)
        {
          menu_items_n_panes = submenu_n_panes[i];
          wv = digest_single_submenu (submenu_start[i], submenu_end[i],
@@ -1874,7 +1871,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
                    {
                      int j;
 
-                     entry = Fcons (entry, Qnil);
+                     entry = list1 (entry);
                      if (!NILP (prefix))
                        entry = Fcons (prefix, entry);
                      for (j = submenu_depth - 1; j >= 0; j--)
@@ -2175,7 +2172,7 @@ xdialog_show (FRAME_PTR f,
                {
                  if (keymaps != 0)
                    {
-                     entry = Fcons (entry, Qnil);
+                     entry = list1 (entry);
                      if (!NILP (prefix))
                        entry = Fcons (prefix, entry);
                    }
@@ -2226,9 +2223,7 @@ menu_help_callback (char const *help_string, int pane, int item)
     pane_name = first_item[MENU_ITEMS_ITEM_NAME];
 
   /* (menu-item MENU-NAME PANE-NUMBER)  */
-  menu_object = Fcons (Qmenu_item,
-                      Fcons (pane_name,
-                             Fcons (make_number (pane), Qnil)));
+  menu_object = list3 (Qmenu_item, pane_name, make_number (pane));
   show_help_echo (help_string ? build_string (help_string) : Qnil,
                  Qnil, menu_object, make_number (item));
 }
@@ -2518,7 +2513,7 @@ xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
                        = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
                      if (keymaps)
                        {
-                         entry = Fcons (entry, Qnil);
+                         entry = list1 (entry);
                          if (!NILP (pane_prefix))
                            entry = Fcons (pane_prefix, entry);
                        }