diff options
| author | Stefan Monnier | 2020-10-04 22:50:38 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2020-10-04 22:50:38 -0400 |
| commit | 14a5db2912d9e4e802c1eeddfb3e551f9fb8f753 (patch) | |
| tree | e22e5a26244e060a680e4f3bd1fa5de0801f6e81 | |
| parent | 5ec21155c39aab8a452d190a260e6912d1d9a920 (diff) | |
| download | emacs-14a5db2912d9e4e802c1eeddfb3e551f9fb8f753.tar.gz emacs-14a5db2912d9e4e802c1eeddfb3e551f9fb8f753.zip | |
* 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`.
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | src/dispnew.c | 17 | ||||
| -rw-r--r-- | src/frame.c | 12 | ||||
| -rw-r--r-- | src/xdisp.c | 13 | ||||
| -rw-r--r-- | test/src/xdisp-tests.el | 24 |
5 files changed, 45 insertions, 25 deletions
| @@ -85,6 +85,10 @@ useful on systems such as FreeBSD which ships only with "etc/termcap". | |||
| 85 | 85 | ||
| 86 | * Changes in Emacs 28.1 | 86 | * Changes in Emacs 28.1 |
| 87 | 87 | ||
| 88 | *** New var 'redisplay-skip-initial-frame' to enable batch redisplay tests. | ||
| 89 | Setting it to nil forces the redisplay to do its job even in the | ||
| 90 | initial frame used in batch mode. | ||
| 91 | |||
| 88 | --- | 92 | --- |
| 89 | ** Support for the 'strike-through' face attribute on TTY frames. | 93 | ** Support for the 'strike-through' face attribute on TTY frames. |
| 90 | If your terminal's termcap or terminfo database entry has the 'smxx' | 94 | If your terminal's termcap or terminfo database entry has the 'smxx' |
diff --git a/src/dispnew.c b/src/dispnew.c index d318e26308e..3f2ae3e6ad1 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -1830,7 +1830,7 @@ adjust_frame_glyphs (struct frame *f) | |||
| 1830 | /* Don't forget the buffer for decode_mode_spec. */ | 1830 | /* Don't forget the buffer for decode_mode_spec. */ |
| 1831 | adjust_decode_mode_spec_buffer (f); | 1831 | adjust_decode_mode_spec_buffer (f); |
| 1832 | 1832 | ||
| 1833 | f->glyphs_initialized_p = 1; | 1833 | f->glyphs_initialized_p = true; |
| 1834 | 1834 | ||
| 1835 | unblock_input (); | 1835 | unblock_input (); |
| 1836 | } | 1836 | } |
| @@ -2251,7 +2251,7 @@ free_glyphs (struct frame *f) | |||
| 2251 | /* Block interrupt input so that we don't get surprised by an X | 2251 | /* Block interrupt input so that we don't get surprised by an X |
| 2252 | event while we're in an inconsistent state. */ | 2252 | event while we're in an inconsistent state. */ |
| 2253 | block_input (); | 2253 | block_input (); |
| 2254 | f->glyphs_initialized_p = 0; | 2254 | f->glyphs_initialized_p = false; |
| 2255 | 2255 | ||
| 2256 | /* Release window sub-matrices. */ | 2256 | /* Release window sub-matrices. */ |
| 2257 | if (!NILP (f->root_window)) | 2257 | if (!NILP (f->root_window)) |
| @@ -3236,9 +3236,16 @@ update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p) | |||
| 3236 | build_frame_matrix (f); | 3236 | build_frame_matrix (f); |
| 3237 | 3237 | ||
| 3238 | /* Update the display. */ | 3238 | /* Update the display. */ |
| 3239 | update_begin (f); | 3239 | if (FRAME_INITIAL_P (f)) |
| 3240 | paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1, false); | 3240 | /* No actual display to update so the "update" is a nop and |
| 3241 | update_end (f); | 3241 | obviously isn't interrupted by pending input. */ |
| 3242 | paused_p = false; | ||
| 3243 | else | ||
| 3244 | { | ||
| 3245 | update_begin (f); | ||
| 3246 | paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p, 1, false); | ||
| 3247 | update_end (f); | ||
| 3248 | } | ||
| 3242 | 3249 | ||
| 3243 | if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) | 3250 | if (FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) |
| 3244 | { | 3251 | { |
diff --git a/src/frame.c b/src/frame.c index 3f934504372..0b707c2af87 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -931,18 +931,18 @@ make_frame (bool mini_p) | |||
| 931 | 931 | ||
| 932 | wset_frame (rw, frame); | 932 | wset_frame (rw, frame); |
| 933 | 933 | ||
| 934 | /* 10 is arbitrary, | 934 | /* 80/25 is arbitrary, |
| 935 | just so that there is "something there." | 935 | just so that there is "something there." |
| 936 | Correct size will be set up later with adjust_frame_size. */ | 936 | Correct size will be set up later with adjust_frame_size. */ |
| 937 | 937 | ||
| 938 | SET_FRAME_COLS (f, 10); | 938 | SET_FRAME_COLS (f, 80); |
| 939 | SET_FRAME_LINES (f, 10); | 939 | SET_FRAME_LINES (f, 25); |
| 940 | SET_FRAME_WIDTH (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f)); | 940 | SET_FRAME_WIDTH (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f)); |
| 941 | SET_FRAME_HEIGHT (f, FRAME_LINES (f) * FRAME_LINE_HEIGHT (f)); | 941 | SET_FRAME_HEIGHT (f, FRAME_LINES (f) * FRAME_LINE_HEIGHT (f)); |
| 942 | 942 | ||
| 943 | rw->total_cols = 10; | 943 | rw->total_cols = FRAME_COLS (f); |
| 944 | rw->pixel_width = rw->total_cols * FRAME_COLUMN_WIDTH (f); | 944 | rw->pixel_width = rw->total_cols * FRAME_COLUMN_WIDTH (f); |
| 945 | rw->total_lines = mini_p ? 9 : 10; | 945 | rw->total_lines = FRAME_LINES (f) - (mini_p ? 1 : 0); |
| 946 | rw->pixel_height = rw->total_lines * FRAME_LINE_HEIGHT (f); | 946 | rw->pixel_height = rw->total_lines * FRAME_LINE_HEIGHT (f); |
| 947 | 947 | ||
| 948 | if (mini_p) | 948 | if (mini_p) |
| @@ -1101,7 +1101,7 @@ make_initial_frame (void) | |||
| 1101 | 1101 | ||
| 1102 | terminal = init_initial_terminal (); | 1102 | terminal = init_initial_terminal (); |
| 1103 | 1103 | ||
| 1104 | f = make_frame (1); | 1104 | f = make_frame (true); |
| 1105 | XSETFRAME (frame, f); | 1105 | XSETFRAME (frame, f); |
| 1106 | 1106 | ||
| 1107 | Vframe_list = Fcons (frame, Vframe_list); | 1107 | Vframe_list = Fcons (frame, Vframe_list); |
diff --git a/src/xdisp.c b/src/xdisp.c index d9101592b2a..85738f361d0 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -15464,7 +15464,8 @@ redisplay_internal (void) | |||
| 15464 | /* No redisplay if running in batch mode or frame is not yet fully | 15464 | /* No redisplay if running in batch mode or frame is not yet fully |
| 15465 | initialized, or redisplay is explicitly turned off by setting | 15465 | initialized, or redisplay is explicitly turned off by setting |
| 15466 | Vinhibit_redisplay. */ | 15466 | Vinhibit_redisplay. */ |
| 15467 | if (FRAME_INITIAL_P (SELECTED_FRAME ()) | 15467 | if ((FRAME_INITIAL_P (SELECTED_FRAME ()) |
| 15468 | && redisplay_skip_initial_frame) | ||
| 15468 | || !NILP (Vinhibit_redisplay)) | 15469 | || !NILP (Vinhibit_redisplay)) |
| 15469 | return; | 15470 | return; |
| 15470 | 15471 | ||
| @@ -35452,6 +35453,12 @@ When nil, mouse-movement events will not be generated as long as the | |||
| 35452 | mouse stays within the extent of a single glyph (except for images). */); | 35453 | mouse stays within the extent of a single glyph (except for images). */); |
| 35453 | mouse_fine_grained_tracking = false; | 35454 | mouse_fine_grained_tracking = false; |
| 35454 | 35455 | ||
| 35456 | DEFVAR_BOOL ("redisplay-skip-initial-frame", redisplay_skip_initial_frame, | ||
| 35457 | doc: /* Non-nil to skip redisplay in initial frame. | ||
| 35458 | The initial frame is not displayed anywhere, so skipping it is | ||
| 35459 | best except in special circumstances such as running redisplay tests | ||
| 35460 | in batch mode. */); | ||
| 35461 | redisplay_skip_initial_frame = true; | ||
| 35455 | } | 35462 | } |
| 35456 | 35463 | ||
| 35457 | 35464 | ||
| @@ -35462,6 +35469,8 @@ init_xdisp (void) | |||
| 35462 | { | 35469 | { |
| 35463 | CHARPOS (this_line_start_pos) = 0; | 35470 | CHARPOS (this_line_start_pos) = 0; |
| 35464 | 35471 | ||
| 35472 | echo_area_window = minibuf_window; | ||
| 35473 | |||
| 35465 | if (!noninteractive) | 35474 | if (!noninteractive) |
| 35466 | { | 35475 | { |
| 35467 | struct window *m = XWINDOW (minibuf_window); | 35476 | struct window *m = XWINDOW (minibuf_window); |
| @@ -35471,8 +35480,6 @@ init_xdisp (void) | |||
| 35471 | struct window *r = XWINDOW (root); | 35480 | struct window *r = XWINDOW (root); |
| 35472 | int i; | 35481 | int i; |
| 35473 | 35482 | ||
| 35474 | echo_area_window = minibuf_window; | ||
| 35475 | |||
| 35476 | r->top_line = FRAME_TOP_MARGIN (f); | 35483 | r->top_line = FRAME_TOP_MARGIN (f); |
| 35477 | r->pixel_top = r->top_line * FRAME_LINE_HEIGHT (f); | 35484 | r->pixel_top = r->top_line * FRAME_LINE_HEIGHT (f); |
| 35478 | r->total_cols = FRAME_COLS (f); | 35485 | r->total_cols = FRAME_COLS (f); |
diff --git a/test/src/xdisp-tests.el b/test/src/xdisp-tests.el index 3d0d0f58302..95c39dacc3e 100644 --- a/test/src/xdisp-tests.el +++ b/test/src/xdisp-tests.el | |||
| @@ -33,19 +33,21 @@ | |||
| 33 | (lambda () | 33 | (lambda () |
| 34 | (insert "hello") | 34 | (insert "hello") |
| 35 | (let ((ol (make-overlay (point) (point))) | 35 | (let ((ol (make-overlay (point) (point))) |
| 36 | (redisplay-skip-initial-frame nil) | ||
| 36 | (max-mini-window-height 1) | 37 | (max-mini-window-height 1) |
| 37 | (text "askdjfhaklsjdfhlkasjdfhklasdhflkasdhflkajsdhflkashdfkljahsdlfkjahsdlfkjhasldkfhalskdjfhalskdfhlaksdhfklasdhflkasdhflkasdhflkajsdhklajsdgh")) | 38 | (text "askdjfhaklsjdfhlkasjdfhklasdhflkasdhflkajsdhflkashdfkljahsdlfkjahsdlfkjhasldkfhalskdjfhalskdfhlaksdhfklasdhflkasdhflkasdhflkajsdhklajsdgh")) |
| 38 | ;; (save-excursion (insert text)) | 39 | ;; (save-excursion (insert text)) |
| 39 | ;; (sit-for 2) | 40 | ;; (sit-for 2) |
| 40 | ;; (delete-region (point) (point-max)) | 41 | ;; (delete-region (point) (point-max)) |
| 41 | (put-text-property 0 1 'cursor t text) | 42 | (put-text-property 0 1 'cursor t text) |
| 42 | (overlay-put ol 'after-string text) | 43 | (overlay-put ol 'after-string text) |
| 43 | (redisplay 'force) | 44 | (let ((executing-kbd-macro nil)) ;Don't skip redisplay |
| 44 | (throw 'result | 45 | (redisplay 'force)) |
| 45 | ;; Make sure we do the see "hello" text. | 46 | (throw 'result |
| 46 | (prog1 (equal (window-start) (point-min)) | 47 | ;; Make sure we do the see "hello" text. |
| 47 | ;; (list (window-start) (window-end) (window-width)) | 48 | (prog1 (equal (window-start) (point-min)) |
| 48 | (delete-overlay ol))))) | 49 | ;; (list (window-start) (window-end) (window-width)) |
| 50 | (delete-overlay ol))))) | ||
| 49 | (let ((executing-kbd-macro t)) ;Force real minibuffer in `read-string'. | 51 | (let ((executing-kbd-macro t)) ;Force real minibuffer in `read-string'. |
| 50 | (read-string "toto: "))))))) | 52 | (read-string "toto: "))))))) |
| 51 | 53 | ||