Comments (6)
Actually I have maybe found a workaround. If it's not too much trouble, can you test out the git branch min-margins
?
from olivetti.
I see, thanks for the explanation. But mostly many thanks for the update, great to have this fixed! Now I can enjoy writing and taking notes in Emacs with proper margins that adjust when I open other applications
from olivetti.
Thanks for the report. I've noticed this too (on macOS). I'm quite sure Emacs is at fault here. With each major version, the window display code get broken a little more. I've tried very hard to get the maintainers to stop breaking the window display code but to no avail.
The most obvious pointer is that the margins are being correctly calculated upon entering full screen but not exiting, which is running the same function on the same hook. It's just that Emacs isn't provided the right values for the function to work.
Evaluating
(olivetti-set-margins)
does not help, so it seems the problem is not with the hook but with the function itself.
This function relies on window-total-width
returning a correct result, which in this case it doesn't.
Feel free to try get the maintainers to either fix this or swoop in and prove me wrong. Either way is cool.
from olivetti.
Thanks a lot!
First of all, I tested the min-margins
branch and it seems to fix the problem for me. However, even though I do not use text-scale-mode
, I had the idea of trying it out because I saw references to it in your latest commits and in the code, and I get strange error messages with the min-margins
branch. You might want to look into that before releasing a new version of the package.
Just another note, regarding window-total-width
: trying the following code in a buffer shows that the function returns a correct result when olivetti-mode is disabled, as well as with the min-margins
branch:
(defun test (&optional win-or-frame)
(message "%s" (window-total-width)))
(add-hook 'window-size-change-functions #'test t t)
However, with master-branch olivetti-mode enabled, the functions then starts reporting erroneous numbers. So it seems master-branch olivetti-set-margins
somehow fails or changes something that then causes window-total-width
to fail as well. I just thought I would point this out, because then you can choose between your new branch that you describe as a "workaround" or fixing the older branch. (Even though I am aware this is maybe not the whole story, because of the way I call the function in my test, ignoring the win-or-frame
argument.)
Either way, thank you for taking the time and please tell me if I can help with further tests.
from olivetti.
Thanks for the investigation. The issue with text-scale-mode
has been fixed in that branch btw.
I understand that it seems like it should work, but it's not the full story. Olivetti is really just doing the following:
- resetting the window margins
- asking for
window-total-width
- calculating the window margins based on that
And that's called on window-size-change-functions
hook.
Which seems simple enough, but resetting the margins also calls window-size-change-functions
. To prevent a loop, Emacs schedules hooks in weird ways. When exiting full screen it's scheduling the hooks incorrectly, or rather just incorrectly to what we want, hence when olivetti asks for window-total-width
it's receiving the wrong value.
from olivetti.
Related Issues (20)
- Please add legacy bindings to the key-map HOT 3
- set-transient-map is set to nil when running olivetti-expand HOT 25
- Olivetti no longer scales with `text-scale-mode`
- Post your screenshots here HOT 9
- Incompatibility with diff-hl and making olivetti a global mode HOT 10
- Maybe not enable visual-line-mode by default? HOT 3
- The new keymap appears to still conflict with (or shadow) org-mode's HOT 3
- Unexpected sync between two olivetti-mode windows HOT 2
- Confliction with git-gutter HOT 2
- How to enable olivetti globally or to some modes HOT 1
- Wrapped text shifts left when company auto-complete comes up HOT 8
- Feature Request: Set Olivetti "gutter" background colour HOT 1
- Middle mouse click does not paste HOT 2
- Side window bug HOT 3
- Fix mouse-wheel events when mouse-wheel-mode is unavailable
- Olivetti errors on org buffer HOT 7
- olivetti-mode isn't activated on the minibuffer when executing isearch commands. HOT 3
- Please share your modeline config HOT 1
- Please explain "a nice writing environment HOT 1
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 olivetti.