[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is it ok to use (redisplay), or should this be left to the experts?

From: Joost Kremers
Subject: Is it ok to use (redisplay), or should this be left to the experts?
Date: Thu, 10 Jan 2019 21:43:44 +0100
User-agent: mu4e 1.1.0; emacs 26.1


I have a package for distraction-free writing[1], which, among other things, activates full screen and sets the text width to a user-defined value. There is an option to set the text width as a percentage of (window-total-width), which is now causing an issue, as reported by a user.[2]

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.

However, I don't want to force a one or two second wait on all my users just because in some conditions, on some system, there may be a race condition. (I can't reproduce the issue on my own computer, for example).

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.

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?



Footnotes: [1]


Joost Kremers
Life has its moments

reply via email to

[Prev in Thread] Current Thread [Next in Thread]