From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Testing redisplay code in batch Date: Wed, 23 Sep 2020 19:16:01 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21066"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Phil Sainty Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 24 01:17:32 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kLE0x-0005Nm-BQ for ged-emacs-devel@m.gmane-mx.org; Thu, 24 Sep 2020 01:17:31 +0200 Original-Received: from localhost ([::1]:53218 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kLE0w-0006ZZ-E1 for ged-emacs-devel@m.gmane-mx.org; Wed, 23 Sep 2020 19:17:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLDzf-0005Nu-9I for emacs-devel@gnu.org; Wed, 23 Sep 2020 19:16:11 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:54793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kLDza-0000XX-0x for emacs-devel@gnu.org; Wed, 23 Sep 2020 19:16:10 -0400 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 8C22E80921; Wed, 23 Sep 2020 19:16:04 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7E946809C7; Wed, 23 Sep 2020 19:16:02 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1600902962; bh=plqAXtNHqb8e0STolk9oswU1QbZ1lY/A8whzOXChWqs=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=S46lYyb+2eG4dB1ePrYJI7UvAfsu0zffU6wfF2O1mmS9wRrul3Je9nZ07FrQYwcvg k+IwGKqtsBFoyYJ/AONpd8cXX8DznXz8aSZVc2psu1L8Tt6VQ9phnn2WJz8RGDyxwL LQF08+bvX432WTHhc8z1/7g35cfIJELhgHK0NVmRbmCIyo0UCuYNoa59C2z18u+4pk QE/3K2sQ7/rnW00Oc2GsqtQ/63+GcNPFTWvDGKhkj/OpiNdiPk0Cx1l02ER5iRDzEa yE3xiQgQaHjdyru3AjdgzYCgBB0K6BAuM9BUAyIOuzV8ZsYx5Ip8Zb6QGrrQrNnl0P WENW6tDtXEYTw== Original-Received: from alfajor (unknown [45.72.232.131]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 54AFF120604; Wed, 23 Sep 2020 19:16:02 -0400 (EDT) In-Reply-To: (Phil Sainty's message of "Wed, 23 Sep 2020 22:34:53 +1200") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 19:16:04 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:256381 Archived-At: >> 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: ")))))))