Comments (10)
Strange, and unfortunately I can't replicate it. What OS and Emacn version are you using?
The fact that window-total-width
returns an incorrect value suggest that it's a problem between Emacs and full-screen on your system, though. Not sure if I can do much about it in that case.
What happens if you build a small pause into writeroom--calculate-width
?
(defun writeroom--calculate-width ()
"Calculate the width of the writing area."
(if (floatp writeroom-width)
(progn
(sleep-for 2)
(message "%s" (window-total-width))
(truncate (* (window-total-width) writeroom-width)))
writeroom-width))
Perhaps it takes a few moments for the UI to catch up...
from writeroom-mode.
yes, It works correctly with a tiny pause. After reading the document, I suggest the following code to fix this:
...
(redisplay)
(setq visual-fill-column-width (writeroom--calculate-width)
...
Of course, you can put (redisplay)
anywhere you like
from writeroom-mode.
Honestly, I'm a little hesitant to add (redisplay)
, because I don't know if it's the right way to deal with this. I've asked on the Emacs mailing list and will let you know if and when I get an answer.
If people advise me against adding (redisplay)
, it'll still be fairly easy to solve your issue, though. You could simply write a custom fullscreen function that calls (redisplay)
and use that instead of the default fullscreen option. I'd be happy to help with the details.
But let's first wait and see what the mailing list says.
from writeroom-mode.
I received some answers to my questions, but I haven't had time to go into them yet. My suggestion would be to add the (redisplay)
to your local copy of writeroom-mode.el
for the moment. Once I implement a permanent solution, I'll let you know.
from writeroom-mode.
got it, thx
from writeroom-mode.
I pushed a commit to the devel branch that hopefully fixes this. The cause of the problem is simply a race condition between the WM enabling full screen and Emacs. The fix involves calculating the width of the text area in the hook window-size-change-functions
, which should run once full screen has been enabled. Apparently, however, there's no guarantee that this will indeed be the case...
Could you try the devel branch and see if it solves the issue for you?
from writeroom-mode.
I just found that my proposed solution causes an annoying bug if a user doesn't actually activate full screen, so I'm gonna have to try and think of something else...
from writeroom-mode.
I seem to be experiencing this issue too now. Does the redisplay
fix not work?
from writeroom-mode.
With redisplay
, the chances of getting a correct result are better, but the underlying problem isn't solved, so I haven't adopted it. I've been meaning to look for a better solution but never got round to it.
from writeroom-mode.
from writeroom-mode.
Related Issues (20)
- Disabling effect HOT 3
- Turn off continuation characters from truncate-lines? HOT 4
- Add screenshot to intro page HOT 2
- hide line number with a hook HOT 3
- how do I add a hook to w3m and eww HOT 1
- Navigating Lines Down and Up HOT 2
- add a "buffer effects" var HOT 6
- writeroom-mode-disable-hook does nothing HOT 2
- [Question] Which theme are you using in the snapshot? HOT 2
- Compensating the width of the line number column HOT 10
- how to auto active global-writeroom-mode when Emacs runs HOT 1
- global-writeroom-mode breaks org mode export scope HOT 3
- how to enable global-writeroom-mode when emacs starts HOT 2
- melpa error HOT 1
- no word wrap after 80 characters? HOT 1
- show actual time or clock? HOT 1
- Emacs -nw resize issue with ultrawide display HOT 4
- Vertical centering HOT 2
- Hide tab-bar-mode in writeroom-mode? HOT 2
- Error when Installing from Melpa HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from writeroom-mode.