]> code.delx.au - gnu-emacs/blobdiff - src/xdisp.c
(SYSTEM_TYPE): Use berkeley-unix.
[gnu-emacs] / src / xdisp.c
index b25f401119511ac8943c7bc43b992138374c2dba..f59f56b0baf226c56f0c6c2287767eb40f50bd95 100644 (file)
@@ -86,7 +86,7 @@ Lisp_Object Voverlay_arrow_position;
 Lisp_Object Voverlay_arrow_string;
 
 /* Values of those variables at last redisplay.  */
-Lisp_Object last_arrow_position, last_arrow_string;
+static Lisp_Object last_arrow_position, last_arrow_string;
 
 /* Nonzero if overlay arrow has been displayed once in this window.  */
 static int overlay_arrow_seen;
@@ -167,15 +167,10 @@ int clip_changed;
 int windows_or_buffers_changed;
 
 \f
-/* Nonzero if FRAME_MESSAGE_BUF (selected_frame) is being used by print;
-   zero if being used by message.  */
-int message_buf_print;
-
-/* dump an informative message to the minibuf */
-/* VARARGS 1 */
-
+/* Specify m, a string, as a message in the minibuf.  If m is 0, clear out
+   any existing message, and let the minibuffer text show through.  */
 void
-message (m, a1, a2, a3)
+message1 (m)
      char *m;
 {
   if (noninteractive)
@@ -183,8 +178,7 @@ message (m, a1, a2, a3)
       if (noninteractive_need_newline)
        putc ('\n', stderr);
       noninteractive_need_newline = 0;
-      fprintf (stderr, m, a1, a2, a3);
-      fprintf (stderr, "\n");
+      fprintf (stderr, "%s\n", m);
       fflush (stderr);
     }
   /* A null message buffer means that the frame hasn't really been
@@ -202,26 +196,10 @@ message (m, a1, a2, a3)
        Fmake_frame_visible (WINDOW_FRAME (XWINDOW (minibuf_window)));
 #endif
 
-      {
-#ifdef NO_ARG_ARRAY
-       int a[3];
-       a[0] = a1;
-       a[1] = a2;
-       a[2] = a3;
-
-       doprnt (FRAME_MESSAGE_BUF (selected_frame),
-               FRAME_WIDTH (selected_frame), m, 0, 3, a);
-#else
-       doprnt (FRAME_MESSAGE_BUF (selected_frame),
-               FRAME_WIDTH (selected_frame), m, 0, 3, &a1);
-#endif                         /* NO_ARG_ARRAY */
-      }
-
-      echo_area_glyphs = FRAME_MESSAGE_BUF (selected_frame);
-
-      /* Print should start at the beginning of the message
-        buffer next time.  */
-      message_buf_print = 0;
+      if (m)
+       echo_area_glyphs = m;
+      else
+       echo_area_glyphs = previous_echo_glyphs = 0;
 
       do_pending_window_change ();
       echo_area_display ();
@@ -230,39 +208,59 @@ message (m, a1, a2, a3)
     }
 }
 
-/* Specify m, a string, as a message in the minibuf.  */
+/* Nonzero if FRAME_MESSAGE_BUF (selected_frame) is being used by print;
+   zero if being used by message.  */
+int message_buf_print;
+
+/* Dump an informative message to the minibuf.  If m is 0, clear out
+   any existing message, and let the minibuffer text show through.  */
+/* VARARGS 1 */
 void
-message1 (m)
+message (m, a1, a2, a3)
      char *m;
 {
   if (noninteractive)
     {
-      if (noninteractive_need_newline)
-       putc ('\n', stderr);
-      noninteractive_need_newline = 0;
-      fprintf (stderr, "%s\n", m);
-      fflush (stderr);
+      if (m)
+       {
+         if (noninteractive_need_newline)
+           putc ('\n', stderr);
+         noninteractive_need_newline = 0;
+         fprintf (stderr, m, a1, a2, a3);
+         fprintf (stderr, "\n");
+         fflush (stderr);
+       }
     }
   /* A null message buffer means that the frame hasn't really been
      initialized yet.  Error messages get reported properly by
      cmd_error, so this must be just an informative message; toss it.  */
   else if (INTERACTIVE && FRAME_MESSAGE_BUF (selected_frame))
     {
-#ifdef MULTI_FRAME
-      Lisp_Object minibuf_frame;
+      if (m)
+       {
+         {
+#ifdef NO_ARG_ARRAY
+           int a[3];
+           a[0] = a1;
+           a[1] = a2;
+           a[2] = a3;
 
-      choose_minibuf_frame ();
-      minibuf_frame = WINDOW_FRAME (XWINDOW (minibuf_window));
-      if (FRAME_VISIBLE_P (selected_frame)
-         && ! FRAME_VISIBLE_P (XFRAME (minibuf_frame)))
-       Fmake_frame_visible (WINDOW_FRAME (XWINDOW (minibuf_window)));
-#endif
+           doprnt (FRAME_MESSAGE_BUF (selected_frame),
+                   FRAME_WIDTH (selected_frame), m, 0, 3, a);
+#else
+           doprnt (FRAME_MESSAGE_BUF (selected_frame),
+                   FRAME_WIDTH (selected_frame), m, 0, 3, &a1);
+#endif                         /* NO_ARG_ARRAY */
+         }
 
-      echo_area_glyphs = m;
-      do_pending_window_change ();
-      echo_area_display ();
-      update_frame (XFRAME (XWINDOW (minibuf_window)->frame), 1, 1);
-      do_pending_window_change ();
+         message1 (FRAME_MESSAGE_BUF (selected_frame));
+       }
+      else
+       message1 (0);
+
+      /* Print should start at the beginning of the message
+        buffer next time.  */
+      message_buf_print = 0;
     }
 }
 
@@ -385,8 +383,8 @@ redisplay ()
 
   /* If specs for an arrow have changed, do thorough redisplay
      to ensure we remove any arrow that should no longer exist.  */
-  if (Voverlay_arrow_position != last_arrow_position
-      || Voverlay_arrow_string != last_arrow_string)
+  if (! EQ (Voverlay_arrow_position, last_arrow_position)
+      || ! EQ (Voverlay_arrow_string, last_arrow_string))
     all_windows = 1, clip_changed = 1;
 
   tlbufpos = this_line_bufpos;
@@ -596,7 +594,7 @@ update:
       XFASTINT (w->last_point_y) = FRAME_CURSOR_Y (selected_frame);
 
       if (all_windows)
-       mark_window_display_accurate (XWINDOW (minibuf_window)->prev, 1);
+       mark_window_display_accurate (FRAME_ROOT_WINDOW (selected_frame), 1);
       else
        {
          w->update_mode_line = Qnil;
@@ -653,6 +651,7 @@ mark_window_display_accurate (window, flag)
 
   for (;!NILP (window); window = w->next)
     {
+      if (XTYPE (window) != Lisp_Window) abort ();
       w = XWINDOW (window);
 
       if (!NILP (w->buffer))
@@ -1776,14 +1775,22 @@ display_mode_line (w)
 
 #ifdef HAVE_X_WINDOWS
   /* I'm trying this out because I saw Unimpress use it, but it's
-     possible that this may mess adversely with some window managers.  jla */
+     possible that this may mess adversely with some window managers.  -jla
+
+     Wouldn't it be nice to use something like mode-line-format to
+     describe frame titles?  -JimB  */
 
-  if (FRAME_IS_X (f)
+  /* Change the title of the frame to the name of the buffer displayed
+     in the currently selected window.  Don't do this for minibuffer frames,
+     and don't do it when there's only one non-minibuffer frame.  */
+  if (FRAME_X_P (f)
       && ! FRAME_MINIBUF_ONLY_P (f)
-      && w == XWINDOW (f->selected_window)
-      && XINT (Flength (Vframe_list)) > 1
-      && (NILP (Fstring_equal (XBUFFER (w->buffer)->name, f->name))))
-    x_set_name (f, XBUFFER (w->buffer)->name, Qnil);
+      && w == XWINDOW (f->selected_window))
+    x_implicitly_set_name (f, (EQ (Fnext_frame (WINDOW_FRAME (w), Qnil),
+                                  WINDOW_FRAME (w))
+                              ? Qnil
+                              : XBUFFER (w->buffer)->name),
+                          Qnil);
 #endif
 }
 
@@ -1998,6 +2005,8 @@ display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt)
 /* Return a string for the output of a mode line %-spec for window W,
    generated by character C and width MAXWIDTH.  */
 
+static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
+
 static char *
 decode_mode_spec (w, c, maxwidth)
      struct window *w;
@@ -2124,7 +2133,6 @@ decode_mode_spec (w, c, maxwidth)
       
     case '-':
       {
-       static char lots_of_dashes[] = "--------------------------------------------------------------------------------------------------------------------------------------------";
        register char *p;
        register int i;
        
@@ -2148,6 +2156,7 @@ decode_mode_spec (w, c, maxwidth)
 \f
 /* Display STRING on one line of window W, starting at HPOS.
    Display at position VPOS.  Caller should have done get_display_line.
+   If VPOS == -1, display it as the current frame's title.
 
   TRUNCATE is GLYPH to display at end if truncated.  Zero for none.
 
@@ -2224,7 +2233,7 @@ display_string (w, vpos, string, hpos, truncate, mincol, maxcol)
        }
       else if (dp != 0 && XTYPE (DISP_CHAR_ROPE (dp, c)) == Lisp_String)
         p1 = copy_rope (p1, start, DISP_CHAR_ROPE (dp, c));
-      else if (c < 0200 && buffer_defaults.ctl_arrow)
+      else if (c < 0200 && ! NILP (buffer_defaults.ctl_arrow))
        {
          if (p1 >= start)
            *p1 = (dp && XTYPE (DISP_CTRL_GLYPH (dp)) == Lisp_Int
@@ -2326,7 +2335,7 @@ init_xdisp ()
   this_line_bufpos = 0;
 
   mini_w = XWINDOW (minibuf_window);
-  root_window = mini_w->prev;
+  root_window = FRAME_ROOT_WINDOW (XFRAME (WINDOW_FRAME (mini_w)));
 
   echo_area_glyphs = 0;
   previous_echo_glyphs = 0;