]> code.delx.au - gnu-emacs/blobdiff - src/xdisp.c
Merge from emacs-24; up to 2012-12-06T01:39:03Z!monnier@iro.umontreal.ca
[gnu-emacs] / src / xdisp.c
index c2789a78ef2224226df50ab7ce200b116eb33b54..8b0d8b6cfa008bec6ab8bb8b85a5c0ea9259b927 100644 (file)
@@ -1,6 +1,7 @@
 /* Display generation from window structure and buffer text.
 
-Copyright (C) 1985-1988, 1993-1995, 1997-2012 Free Software Foundation, Inc.
+Copyright (C) 1985-1988, 1993-1995, 1997-2013 Free Software Foundation,
+Inc.
 
 This file is part of GNU Emacs.
 
@@ -9397,7 +9398,8 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
       int old_windows_or_buffers_changed = windows_or_buffers_changed;
       ptrdiff_t point_at_end = 0;
       ptrdiff_t zv_at_end = 0;
-      Lisp_Object old_deactivate_mark, tem;
+      Lisp_Object old_deactivate_mark;
+      bool shown;
       struct gcpro gcpro1;
 
       old_deactivate_mark = Vdeactivate_mark;
@@ -9539,9 +9541,9 @@ message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte)
       unchain_marker (XMARKER (oldbegv));
       unchain_marker (XMARKER (oldzv));
 
-      tem = Fget_buffer_window (Fcurrent_buffer (), Qt);
+      shown = buffer_window_count (current_buffer) > 0;
       set_buffer_internal (oldbuf);
-      if (NILP (tem))
+      if (!shown)
        windows_or_buffers_changed = old_windows_or_buffers_changed;
       message_log_need_newline = !nlflag;
       Vdeactivate_mark = old_deactivate_mark;
@@ -12951,49 +12953,6 @@ reconsider_clip_changes (struct window *w, struct buffer *b)
 }
 \f
 
-/* Select FRAME to forward the values of frame-local variables into C
-   variables so that the redisplay routines can access those values
-   directly.  */
-
-static void
-select_frame_for_redisplay (Lisp_Object frame)
-{
-  Lisp_Object tail, tem;
-  Lisp_Object old = selected_frame;
-  struct Lisp_Symbol *sym;
-
-  eassert (FRAMEP (frame) && FRAME_LIVE_P (XFRAME (frame)));
-
-  selected_frame = frame;
-  /* If redisplay causes scrolling, it sets point in the window, so we need to
-     be careful with the selected-window's point handling.  */
-  select_window_1 (XFRAME (frame)->selected_window, 0);
-
-  do {
-    for (tail = XFRAME (frame)->param_alist;
-        CONSP (tail); tail = XCDR (tail))
-      if (CONSP (XCAR (tail))
-         && (tem = XCAR (XCAR (tail)),
-             SYMBOLP (tem))
-         && (sym = indirect_variable (XSYMBOL (tem)),
-             sym->redirect == SYMBOL_LOCALIZED)
-         && sym->val.blv->frame_local)
-       /* Use find_symbol_value rather than Fsymbol_value
-          to avoid an error if it is void.  */
-       find_symbol_value (tem);
-  } while (!EQ (frame, old) && (frame = old, 1));
-}
-
-/* Make sure that previously selected OLD_FRAME is selected unless it has been
-   deleted (by an X connection failure during redisplay, for example).  */
-
-static void
-ensure_selected_frame (Lisp_Object frame)
-{
-  if (!EQ (frame, selected_frame) && FRAME_LIVE_P (XFRAME (frame)))
-    select_frame_for_redisplay (frame);
-}
-
 #define STOP_POLLING                                   \
 do { if (! polling_stopped_here) stop_polling ();      \
        polling_stopped_here = 1; } while (0)
@@ -13019,7 +12978,7 @@ redisplay_internal (void)
   ptrdiff_t count, count1;
   struct frame *sf;
   int polling_stopped_here = 0;
-  Lisp_Object tail, frame, old_frame = selected_frame;
+  Lisp_Object tail, frame;
   struct backtrace backtrace;
 
   /* Non-zero means redisplay has to consider all windows on all
@@ -13078,12 +13037,6 @@ redisplay_internal (void)
   /* Remember the currently selected window.  */
   sw = w;
 
-  /* When running redisplay, we play a bit fast-and-loose and allow e.g.
-     selected_frame and selected_window to be temporarily out-of-sync so
-     when we come back here via `goto retry', we need to resync because we
-     may need to run Elisp code (via prepare_menu_bars).  */
-  ensure_selected_frame (old_frame);
-
   pending = 0;
   reconsider_clip_changes (w, current_buffer);
   last_escape_glyph_frame = NULL;
@@ -13491,9 +13444,6 @@ redisplay_internal (void)
 
          if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf)
            {
-             /* Select the frame, for the sake of frame-local variables.  */
-             ensure_selected_frame (frame);
-
              /* Mark all the scroll bars to be removed; we'll redeem
                 the ones we want when we redisplay their windows.  */
              if (FRAME_TERMINAL (f)->condemn_scroll_bars_hook)
@@ -13543,10 +13493,6 @@ redisplay_internal (void)
            }
        }
 
-      /* We played a bit fast-and-loose above and allowed selected_frame
-        and selected_window to be temporarily out-of-sync but let's make
-        sure this stays contained.  */
-      ensure_selected_frame (old_frame);
       eassert (EQ (XFRAME (selected_frame)->selected_window, selected_window));
 
       if (!pending)
@@ -13772,7 +13718,6 @@ static Lisp_Object
 unwind_redisplay (Lisp_Object old_frame)
 {
   redisplaying_p = 0;
-  ensure_selected_frame (old_frame);
   return Qnil;
 }
 
@@ -14245,7 +14190,12 @@ set_cursor_from_row (struct window *w, struct glyph_row *row,
         CHARPOS is zero or negative.  */
       int empty_line_p =
        (row->reversed_p ? glyph > glyphs_end : glyph < glyphs_end)
-       && INTEGERP (glyph->object) && glyph->charpos > 0;
+       && INTEGERP (glyph->object) && glyph->charpos > 0
+       /* On a TTY, continued and truncated rows also have a glyph at
+          their end whose OBJECT is zero and whose CHARPOS is
+          positive (the continuation and truncation glyphs), but such
+          rows are obviously not "empty".  */
+       && !(row->continued_p || row->truncated_on_right_p);
 
       if (row->ends_in_ellipsis_p && pos_after == last_pos)
        {
@@ -15705,7 +15655,6 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
          /* Some people insist on not letting point enter the scroll
             margin, even though this part handles windows that didn't
             scroll at all.  */
-         struct frame *f = XFRAME (w->frame);
          int margin = min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
          int pixel_margin = margin * FRAME_LINE_HEIGHT (f);
          bool header_line = WINDOW_WANTS_HEADER_LINE_P (w);