unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Is it ok to use (redisplay), or should this be left to the experts?
@ 2019-01-10 20:43 Joost Kremers
  2019-01-10 22:02 ` Stefan Monnier
  2019-01-11  7:24 ` Eli Zaretskii
  0 siblings, 2 replies; 8+ messages in thread
From: Joost Kremers @ 2019-01-10 20:43 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi,

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?

TIA

Joost




Footnotes: 
[1]  https://github.com/joostkremers/writeroom-mode

[2]  https://github.com/joostkremers/writeroom-mode/issues/48

-- 
Joost Kremers
Life has its moments



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-02-12 14:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-01-10 20:43 Is it ok to use (redisplay), or should this be left to the experts? Joost Kremers
2019-01-10 22:02 ` Stefan Monnier
2019-02-11 23:27   ` Joost Kremers
2019-02-12  3:58     ` Stefan Monnier
2019-02-12  8:06       ` Joost Kremers
2019-02-12 14:45         ` Stefan Monnier
2019-01-11  7:24 ` Eli Zaretskii
2019-02-11 23:43   ` Joost Kremers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).