From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Testing redisplay code in batch Date: Wed, 23 Sep 2020 10:50:45 +0000 Message-ID: <20200923105045.GC6178@ACM> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6566"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 23 12:51:36 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 1kL2N6-0001b2-78 for ged-emacs-devel@m.gmane-mx.org; Wed, 23 Sep 2020 12:51:36 +0200 Original-Received: from localhost ([::1]:53296 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL2N5-0004cQ-9n for ged-emacs-devel@m.gmane-mx.org; Wed, 23 Sep 2020 06:51:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52368) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL2MP-0004CX-HL for emacs-devel@gnu.org; Wed, 23 Sep 2020 06:50:53 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:13230 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.90_1) (envelope-from ) id 1kL2MN-00081Y-4a for emacs-devel@gnu.org; Wed, 23 Sep 2020 06:50:53 -0400 Original-Received: (qmail 98221 invoked by uid 3782); 23 Sep 2020 10:50:46 -0000 Original-Received: from acm.muc.de (p4fe156c4.dip0.t-ipconnect.de [79.225.86.196]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Wed, 23 Sep 2020 12:50:45 +0200 Original-Received: (qmail 6903 invoked by uid 1000); 23 Sep 2020 10:50:45 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de Received-SPF: pass client-ip=193.149.48.1; envelope-from=acm@muc.de; helo=mail.muc.de X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/23 06:50:47 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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:256353 Archived-At: Hello, Stefan. On Tue, Sep 22, 2020 at 23:56:33 -0400, Stefan Monnier wrote: > I have a test for the Bug#43519 which I'd like to add to our test suite, > but it requires the redisplay to do its job, and in batch mode it seems > that Mr. Redisplay gets quite sloppy. > Does someone have experience with batch-tests of redisplay code? > So far I've only use the "let-bind execute-kbd-macro to t" trick in > order to convince minibuffer functions to actually use a minibuffer > and process events from `unread-command-events`, but here I need to go > further because I the "dummy windows" used in batch mode aren't > good enough. > So I'm ideally looking for a way to convince Emacs's internals to > perform redisplay as if there were "real" windows. I don't need to > "see/display" the result, OTOH because I only need to test things like > `window-start` and `window-end` after calling `redisplay`. > If that can't be done without major surgery to the C code, has someone > already setup some way to run interactive tests in some virtual > interactive session (I guess using something like a detached `screen` or > `tmux`)? Have a look at .../tests/000tests.el in standalone CC Mode. In particular, look at this function (which has been in place for ~18 years): (defun cc-test-force-font-lock-buffer () ;; Try to forcibly font lock the current buffer, even in batch mode. ;; We're doing really dirty things to trick font-lock into action in ;; batch mode in the different emacsen. (let ((orig-noninteractive-function (and (fboundp 'noninteractive) (symbol-function 'noninteractive))) (orig-noninteractive-variable (and (boundp 'noninteractive) (symbol-value 'noninteractive))) ;; font-lock in XEmacs 19 looks at a variable named `noninteractive'. (noninteractive nil)) (unwind-protect (progn (when orig-noninteractive-function ;; XEmacs (at least 21.4) calls `noninteractive' to check ;; for batch mode, so we let it lie. (fset 'noninteractive (lambda () nil))) (font-lock-mode 1) (unless (or (get-text-property (point-min) 'face) (next-single-property-change (point-min) 'face)) ;; Some emacsen have already fontified the buffer above, ;; but others need some more coercion.. (let (;; Avoid getting some lazy fontification package that ;; might decide that nothing should be done. (font-lock-fontify-buffer-function 'font-lock-default-fontify-buffer)) (font-lock-fontify-buffer)))) (when orig-noninteractive-function (fset 'noninteractive orig-noninteractive-function))))) > Stefan -- Alan Mackenzie (Nuremberg, Germany).