[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Testing redisplay code in batch
From: |
Stefan Monnier |
Subject: |
Re: Testing redisplay code in batch |
Date: |
Wed, 23 Sep 2020 19:16:01 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>> Does someone have experience with batch-tests of redisplay code?
> No, but FWIW the subject came up here:
> https://lists.gnu.org/archive/html/emacs-devel/2019-10/msg00971.html
Thanks for digging it up.
Based on the hint from Eli in it, the simple patch below was enough to
make my test "work" in batch mode!
This means: with this patch, the xdisp-tests.el succeeds or not in batch
mode depending on whether the resize_mini_window patch has been applied!
Yay!
WDYT?
Should we add a `internal--force-redisplay-in-initial-terminal` variable
(with a suitable docstring hinting at the fact that setting this to non-nil
means you'll probably be using code paths that no-one has used before)?
Stefan
diff --git a/src/dispnew.c b/src/dispnew.c
index d318e26308..4d585bd3e0 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -3236,9 +3236,14 @@ 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))
+ paused_p = false; /* No actual display to update! */
+ 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 3f93450437..bf5f6ef910 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/40 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, 40);
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);
@@ -1136,6 +1136,7 @@ make_initial_frame (void)
init_frame_faces (f);
last_nonminibuf_frame = f;
+ echo_area_window = f->minibuffer_window;
f->can_set_window_size = true;
f->after_make_frame = true;
diff --git a/src/xdisp.c b/src/xdisp.c
index 8fadff972f..2505fedbe8 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11818,7 +11818,7 @@ resize_mini_window (struct window *w, bool exact_p)
don't force w->start to be at the beginning of a screen
line, important parts of the stuff in the mini-window,
such as user prompt, will be hidden from view. */
- move_it_by_lines (&it, 0);
+ move_it_by_lines (&it, 0); /* bug#43519 */
start = it.current.pos;
}
else
@@ -15414,8 +15414,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 ())
- || !NILP (Vinhibit_redisplay))
+ if (/* FRAME_INITIAL_P (SELECTED_FRAME ())
+ * || */ !NILP (Vinhibit_redisplay))
return;
/* Don't examine these until after testing Vinhibit_redisplay.
diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el
index 3d0d0f5830..af46c72398 100644
--- a/test/src/xdisp-tests.el
+++ b/test/src/xdisp-tests.el
@@ -35,17 +35,18 @@ xdisp-tests--minibuffer-resizing
(let ((ol (make-overlay (point) (point)))
(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: ")))))))
Re: Testing redisplay code in batch, Alan Mackenzie, 2020/09/23
Re: Testing redisplay code in batch, Eli Zaretskii, 2020/09/23