From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: Is it ok to use (redisplay), or should this be left to the experts? Date: Fri, 11 Jan 2019 09:24:54 +0200 Message-ID: <83pnt3hd15.fsf@gnu.org> References: <871s5ktf9b.fsf@fastmail.fm> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1547191400 1379 195.159.176.226 (11 Jan 2019 07:23:20 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 11 Jan 2019 07:23:20 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 11 08:23:16 2019 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ghr9w-0000Ed-7X for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Jan 2019 08:23:16 +0100 Original-Received: from localhost ([127.0.0.1]:38248 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghrC3-0000Lz-79 for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Jan 2019 02:25:27 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:38147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghrBa-0000Lf-3r for help-gnu-emacs@gnu.org; Fri, 11 Jan 2019 02:24:59 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:55981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ghrBa-0008II-2J for help-gnu-emacs@gnu.org; Fri, 11 Jan 2019 02:24:58 -0500 Original-Received: from [176.228.60.248] (port=4187 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1ghrBZ-0003eO-MM for help-gnu-emacs@gnu.org; Fri, 11 Jan 2019 02:24:58 -0500 In-reply-to: <871s5ktf9b.fsf@fastmail.fm> (message from Joost Kremers on Thu, 10 Jan 2019 21:43:44 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:119106 Archived-At: > From: Joost Kremers > Date: Thu, 10 Jan 2019 21:43:44 +0100 > > The problem is that although full screen is activated before > calculating the text width, (window-total-width) still reports the > window width that existed before full screen was activated. This > seems to be some sort of race condition, because adding (sleep-for > 2) before calling (window-total-width) solves the issue. Does (sit-for 0) also solve the issue? If not, try values of argument smaller than a second, starting from, say, 0.02, and see if some small enough value resolves the problem. > It seems that a call to (redisplay) also does the trick, but I'm > hesitant to add this, because, well, I'm not sure why, exactly, > it's just that I'm not entirely sure when, i.e., in what > circumstances, (redisplay) is meant to be used, what side effects > to watch out for (in any), etc. There should be no problem with invoking 'redisplay', it just slows down the program a bit, especially if the code in question will or might be executed frequently. However, sit-for is IMO better, because in some use cases you must allow for the window manager to respond to the full-screen request and for Emacs to receive a notification from the window manager. And that means waiting for some short time. > So I guess what I'm asking is whether someone can tell me whether > (redisplay) is the right way to deal with this issue, or whether > there is a better way. Or perhaps the user is SOL and needs to do > some local configuration to get things to behave? I cannot answer this because it isn't clear to me who initiated full-screen: the user or the package. If it's the package, then the package should also accommodate these issues, perhaps only when the frame size changes significantly.