[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Is it ok to use (redisplay), or should this be left to the experts?
From: |
Eli Zaretskii |
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 |
> From: Joost Kremers <joostkremers@fastmail.fm>
> 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.