emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 14a5db2: * src/xdisp.c (syms_of_xdisp): New var `redisplay_skip_i


From: Stefan Monnier
Subject: master 14a5db2: * src/xdisp.c (syms_of_xdisp): New var `redisplay_skip_initial_frame`.
Date: Sun, 4 Oct 2020 22:50:48 -0400 (EDT)

branch: master
commit 14a5db2912d9e4e802c1eeddfb3e551f9fb8f753
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * src/xdisp.c (syms_of_xdisp): New var `redisplay_skip_initial_frame`.
    
    This makes it possible to run most of the redisplay code (tho not the
    actual drawing since there's nowhere to draw) even when there's no
    real frame at hand, as is the case in batch mode.
    This makes `xdisp-tests--minibuffer-resizing` work even in batch.
    
    (redisplay_internal): Obey it.
    (init_xdisp): Set `echo_area_window` even in noninteractive mode.
    * src/dispnew.c (update_frame): Skip the initial frame.
    * src/frame.c (make_frame): Use 80x25 as the default initial size.
    
    * test/src/xdisp-tests.el (xdisp-tests--minibuffer-resizing):
    Use the new var and fix use of `executing-kbd-macro`.
---
 etc/NEWS                |  4 ++++
 src/dispnew.c           | 17 ++++++++++++-----
 src/frame.c             | 12 ++++++------
 src/xdisp.c             | 13 ++++++++++---
 test/src/xdisp-tests.el | 24 +++++++++++++-----------
 5 files changed, 45 insertions(+), 25 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index d671561..cda4430 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -85,6 +85,10 @@ useful on systems such as FreeBSD which ships only with 
"etc/termcap".
 
 * Changes in Emacs 28.1
 
+*** New var 'redisplay-skip-initial-frame' to enable batch redisplay tests.
+Setting it to nil forces the redisplay to do its job even in the
+initial frame used in batch mode.
+
 ---
 ** Support for the 'strike-through' face attribute on TTY frames.
 If your terminal's termcap or terminfo database entry has the 'smxx'
diff --git a/src/dispnew.c b/src/dispnew.c
index d318e26..3f2ae3e 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1830,7 +1830,7 @@ adjust_frame_glyphs (struct frame *f)
   /* Don't forget the buffer for decode_mode_spec.  */
   adjust_decode_mode_spec_buffer (f);
 
-  f->glyphs_initialized_p = 1;
+  f->glyphs_initialized_p = true;
 
   unblock_input ();
 }
@@ -2251,7 +2251,7 @@ free_glyphs (struct frame *f)
       /* Block interrupt input so that we don't get surprised by an X
          event while we're in an inconsistent state.  */
       block_input ();
-      f->glyphs_initialized_p = 0;
+      f->glyphs_initialized_p = false;
 
       /* Release window sub-matrices.  */
       if (!NILP (f->root_window))
@@ -3236,9 +3236,16 @@ update_frame (struct frame *f, bool force_p, bool 
inhibit_hairy_id_p)
       build_frame_matrix (f);
 
       /* Update the display.  */
-      update_begin (f);
-      paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1, false);
-      update_end (f);
+      if (FRAME_INITIAL_P (f))
+        /* No actual display to update so the "update" is a nop and
+           obviously isn't interrupted by pending input.  */
+        paused_p = false;
+      else
+        {
+          update_begin (f);
+          paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1, false);
+          update_end (f);
+        }
 
       if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f))
         {
diff --git a/src/frame.c b/src/frame.c
index 3f93450..0b707c2 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -931,18 +931,18 @@ make_frame (bool mini_p)
 
   wset_frame (rw, frame);
 
-  /* 10 is arbitrary,
+  /* 80/25 is arbitrary,
      just so that there is "something there."
      Correct size will be set up later with adjust_frame_size.  */
 
-  SET_FRAME_COLS (f, 10);
-  SET_FRAME_LINES (f, 10);
+  SET_FRAME_COLS (f, 80);
+  SET_FRAME_LINES (f, 25);
   SET_FRAME_WIDTH (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f));
   SET_FRAME_HEIGHT (f, FRAME_LINES (f) * FRAME_LINE_HEIGHT (f));
 
-  rw->total_cols = 10;
+  rw->total_cols = FRAME_COLS (f);
   rw->pixel_width = rw->total_cols * FRAME_COLUMN_WIDTH (f);
-  rw->total_lines = mini_p ? 9 : 10;
+  rw->total_lines = FRAME_LINES (f) - (mini_p ? 1 : 0);
   rw->pixel_height = rw->total_lines * FRAME_LINE_HEIGHT (f);
 
   if (mini_p)
@@ -1101,7 +1101,7 @@ make_initial_frame (void)
 
   terminal = init_initial_terminal ();
 
-  f = make_frame (1);
+  f = make_frame (true);
   XSETFRAME (frame, f);
 
   Vframe_list = Fcons (frame, Vframe_list);
diff --git a/src/xdisp.c b/src/xdisp.c
index d910159..85738f3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -15464,7 +15464,8 @@ redisplay_internal (void)
   /* No redisplay if running in batch mode or frame is not yet fully
      initialized, or redisplay is explicitly turned off by setting
      Vinhibit_redisplay.  */
-  if (FRAME_INITIAL_P (SELECTED_FRAME ())
+  if ((FRAME_INITIAL_P (SELECTED_FRAME ())
+       && redisplay_skip_initial_frame)
       || !NILP (Vinhibit_redisplay))
     return;
 
@@ -35452,6 +35453,12 @@ When nil, mouse-movement events will not be generated 
as long as the
 mouse stays within the extent of a single glyph (except for images).  */);
   mouse_fine_grained_tracking = false;
 
+  DEFVAR_BOOL ("redisplay-skip-initial-frame", redisplay_skip_initial_frame,
+    doc: /* Non-nil to skip redisplay in initial frame.
+The initial frame is not displayed anywhere, so skipping it is
+best except in special circumstances such as running redisplay tests
+in batch mode.   */);
+  redisplay_skip_initial_frame = true;
 }
 
 
@@ -35462,6 +35469,8 @@ init_xdisp (void)
 {
   CHARPOS (this_line_start_pos) = 0;
 
+  echo_area_window = minibuf_window;
+
   if (!noninteractive)
     {
       struct window *m = XWINDOW (minibuf_window);
@@ -35471,8 +35480,6 @@ init_xdisp (void)
       struct window *r = XWINDOW (root);
       int i;
 
-      echo_area_window = minibuf_window;
-
       r->top_line = FRAME_TOP_MARGIN (f);
       r->pixel_top = r->top_line * FRAME_LINE_HEIGHT (f);
       r->total_cols = FRAME_COLS (f);
diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el
index 3d0d0f5..95c39da 100644
--- a/test/src/xdisp-tests.el
+++ b/test/src/xdisp-tests.el
@@ -33,19 +33,21 @@
           (lambda ()
             (insert "hello")
             (let ((ol (make-overlay (point) (point)))
+                  (redisplay-skip-initial-frame nil)
                   (max-mini-window-height 1)
                   (text 
"askdjfhaklsjdfhlkasjdfhklasdhflkasdhflkajsdhflkashdfkljahsdlfkjahsdlfkjhasldkfhalskdjfhalskdfhlaksdhfklasdhflkasdhflkasdhflkajsdhklajsdgh"))
-             ;; (save-excursion (insert text))
-             ;; (sit-for 2)
-             ;; (delete-region (point) (point-max))
-             (put-text-property 0 1 'cursor t text)
-             (overlay-put ol 'after-string text)
-             (redisplay 'force)
-             (throw 'result
-                    ;; Make sure we do the see "hello" text.
-                    (prog1 (equal (window-start) (point-min))
-                      ;; (list (window-start) (window-end) (window-width))
-                      (delete-overlay ol)))))
+              ;; (save-excursion (insert text))
+              ;; (sit-for 2)
+              ;; (delete-region (point) (point-max))
+              (put-text-property 0 1 'cursor t text)
+              (overlay-put ol 'after-string text)
+              (let ((executing-kbd-macro nil)) ;Don't skip redisplay
+                (redisplay 'force))
+              (throw 'result
+                     ;; Make sure we do the see "hello" text.
+                     (prog1 (equal (window-start) (point-min))
+                       ;; (list (window-start) (window-end) (window-width))
+                       (delete-overlay ol)))))
         (let ((executing-kbd-macro t)) ;Force real minibuffer in `read-string'.
           (read-string "toto: ")))))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]