]> code.delx.au - gnu-emacs/blobdiff - src/xfns.c
(Fbury_buffer): If buffer is in selected window, remove it.
[gnu-emacs] / src / xfns.c
index 603d2a8013db0efaf5021d8aff6eec74ad5c807c..bbc83952bc657627b664e288903d1ecb0a8354b7 100644 (file)
@@ -968,7 +968,7 @@ x_real_positions (f, xptr, yptr)
 
   while (1)
     {
-      x_catch_errors (FRAME_X_DISPLAY (f));
+      int count = x_catch_errors (FRAME_X_DISPLAY (f));
 
       XQueryTree (FRAME_X_DISPLAY (f), outer, &tmp_root_window,
                  &f->output_data.x->parent_desc,
@@ -1010,11 +1010,11 @@ x_real_positions (f, xptr, yptr)
         Detect that and try the whole thing over.  */
       if (! x_had_errors_p (FRAME_X_DISPLAY (f)))
        {
-         x_uncatch_errors (FRAME_X_DISPLAY (f));
+         x_uncatch_errors (FRAME_X_DISPLAY (f), count);
          break;
        }
 
-      x_uncatch_errors (FRAME_X_DISPLAY (f));
+      x_uncatch_errors (FRAME_X_DISPLAY (f), count);
     }
 
   *xptr = f->output_data.x->left_pos - win_x;
@@ -1266,6 +1266,7 @@ x_set_mouse_color (f, arg, oldval)
      Lisp_Object arg, oldval;
 {
   Cursor cursor, nontext_cursor, mode_cursor, cross_cursor;
+  int count;
   int mask_color;
 
   if (!EQ (Qnil, arg))
@@ -1280,7 +1281,7 @@ x_set_mouse_color (f, arg, oldval)
   BLOCK_INPUT;
 
   /* It's not okay to crash if the user selects a screwy cursor.  */
-  x_catch_errors (FRAME_X_DISPLAY (f));
+  count = x_catch_errors (FRAME_X_DISPLAY (f));
 
   if (!EQ (Qnil, Vx_pointer_shape))
     {
@@ -1323,7 +1324,7 @@ x_set_mouse_color (f, arg, oldval)
 
   /* Check and report errors with the above calls.  */
   x_check_errors (FRAME_X_DISPLAY (f), "can't set cursor shape: %s");
-  x_uncatch_errors (FRAME_X_DISPLAY (f));
+  x_uncatch_errors (FRAME_X_DISPLAY (f), count);
 
   {
     XColor fore_color, back_color;
@@ -1726,6 +1727,9 @@ x_set_menu_bar_lines (f, value, oldval)
   else
     nlines = 0;
 
+  /* Make sure we redisplay all windows in this frame.  */
+  windows_or_buffers_changed++;
+
 #ifdef USE_X_TOOLKIT
   FRAME_MENU_BAR_LINES (f) = 0;
   if (nlines)
@@ -2000,8 +2004,8 @@ x_set_scroll_bar_width (f, arg, oldval)
     {
       int wid = FONT_WIDTH (f->output_data.x->font);
 
-      if (XFASTINT (arg) < 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM)
-       Fsignal (Qargs_out_of_range, Fcons (arg, Qnil));
+      if (XFASTINT (arg) <= 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM)
+       XSETINT (arg, 2 * VERTICAL_SCROLL_BAR_WIDTH_TRIM + 1);
 
       FRAME_SCROLL_BAR_PIXEL_WIDTH (f) = XFASTINT (arg);
       FRAME_SCROLL_BAR_COLS (f) = (XFASTINT (arg) + wid-1) / wid;
@@ -2717,6 +2721,10 @@ x_window (f, window_prompting, minibuffer_only)
     }
 
     len = strlen (shell_position) + 1;
+    /* We don't free this because we don't know whether
+       it is safe to free it while the frame exists.
+       It isn't worth the trouble of arranging to free it
+       when the frame is deleted.  */
     tem = (char *) xmalloc (len);
     strncpy (tem, shell_position, len);
     XtSetArg (al[ac], XtNgeometry, tem); ac++;
@@ -3194,16 +3202,26 @@ This function is an internal primitive--use `make-frame' instead.")
   {
     Lisp_Object font;
 
-    font = x_get_arg (parms, Qfont, "font", "Font", string);
-    if (!STRINGP (font))
-      font = x_get_arg (parms, Qfontset, "fontset", "Fontset", string);
+    /* Determine font by the following priority.
+       1. `font' parameter in parms.
+       2. `font' parameter in Vdefault_frame_alist.
+       3. X resource "font" ("Font").
+       4. Select a plausible font be heuristics at least for ASCII.  */
+    tem = Fassq (Qfont, parms);
+    if (NILP (tem))
+      tem = Fassq (Qfont, Vdefault_frame_alist);
+    if (!NILP (tem))
+      font = Fcdr (tem);
+    if (! STRINGP (font))
+      font = x_get_arg (parms, Qfont, "font", "Font", string);
+
     BLOCK_INPUT;
     /* First, try whatever font the caller has specified.  */
     if (STRINGP (font))
       {
-       Lisp_Object fontset = Fquery_fontset (font);
-       if (STRINGP (fontset))
-         font = x_new_fontset (f, XSTRING (fontset)->data);
+       tem = Fquery_fontset (font);
+       if (STRINGP (tem))
+         font = x_new_fontset (f, XSTRING (tem)->data);
        else
          font = x_new_font (f, XSTRING (font)->data);
       }
@@ -3223,7 +3241,7 @@ This function is an internal primitive--use `make-frame' instead.")
     if (! STRINGP (font))
       font = build_string ("fixed");
 
-    x_default_parameter (f, parms, Qfont, font, 
+    x_default_parameter (f, parms, Qfont, font,
                         "font", "Font", string);
   }
 
@@ -3420,6 +3438,7 @@ fonts to match.  The first MAXIMUM fonts are reported.")
   FRAME_PTR f;
   Lisp_Object key;
   int maxnames;
+  int count;
 
   check_x ();
   CHECK_STRING (pattern, 0);
@@ -3485,13 +3504,13 @@ fonts to match.  The first MAXIMUM fonts are reported.")
        {
          XFontStruct *thisinfo;
 
-         x_catch_errors (FRAME_X_DISPLAY (f));
+         count = x_catch_errors (FRAME_X_DISPLAY (f));
 
          thisinfo = XLoadQueryFont (FRAME_X_DISPLAY (f),
                                     XSTRING (XCONS (tem)->car)->data);
 
          x_check_errors (FRAME_X_DISPLAY (f), "XLoadQueryFont failure: %s");
-         x_uncatch_errors (FRAME_X_DISPLAY (f));
+         x_uncatch_errors (FRAME_X_DISPLAY (f), count);
 
          if (thisinfo && same_size_fonts (thisinfo, size_ref))
            newlist = Fcons (XCONS (tem)->car, newlist);
@@ -3507,7 +3526,7 @@ fonts to match.  The first MAXIMUM fonts are reported.")
 
   BLOCK_INPUT;
 
-  x_catch_errors (FRAME_X_DISPLAY (f));
+  count = x_catch_errors (FRAME_X_DISPLAY (f));
 
   /* Solaris 2.3 has a bug in XListFontsWithInfo.  */
 #ifndef BROKEN_XLISTFONTSWITHINFO
@@ -3525,7 +3544,7 @@ fonts to match.  The first MAXIMUM fonts are reported.")
                        &num_fonts); /* count_return */
 
   x_check_errors (FRAME_X_DISPLAY (f), "XListFonts failure: %s");
-  x_uncatch_errors (FRAME_X_DISPLAY (f));
+  x_uncatch_errors (FRAME_X_DISPLAY (f), count);
 
   UNBLOCK_INPUT;
 
@@ -3560,11 +3579,11 @@ fonts to match.  The first MAXIMUM fonts are reported.")
 
              BLOCK_INPUT;
 
-             x_catch_errors (FRAME_X_DISPLAY (f));
+             count = x_catch_errors (FRAME_X_DISPLAY (f));
              thisinfo = XLoadQueryFont (FRAME_X_DISPLAY (f), names[i]);
              x_check_errors (FRAME_X_DISPLAY (f),
                              "XLoadQueryFont failure: %s");
-             x_uncatch_errors (FRAME_X_DISPLAY (f));
+             x_uncatch_errors (FRAME_X_DISPLAY (f), count);
 
              UNBLOCK_INPUT;