joostkremers / writeroom-mode

Writeroom-mode: distraction-free writing for Emacs.
BSD 3-Clause "New" or "Revised" License
611 stars 28 forks source link

Displaying line numbers in writeroom-mode kills left margin. #20

Closed clamydo closed 9 years ago

clamydo commented 9 years ago

When inside writeroom-mode, enabling the line numbers (linum-mode) kills the left margin completely, so that the text is not centered anymore. Re-enabling writeroom-mode fixes the margin, but hides the line numbers again.

Disclaimer: New to emacs. Using spacemacs. Havn't tried with vanilla emacs.

joostkremers commented 9 years ago

Hi, sorry for the late reply (I was on vacation).

linum-mode has its own ideas about the width of the window margins. There's not much that writeroom-mode can do about that, except to note that the two aren't really compatible.

The only solution I can see is if linum-mode would respect the existing margin widths. But I have no idea if that is possible or not.

Sorry I can't be of more help.

joostkremers commented 9 years ago

I just noticed that nlinum-mode (available from ELPA; I have no idea how it can be installed / used in Spacemacs, though) behaves better in this respect. It's still not perfect, but it's usable. Two remaining problems that I've noticed:

1) when nlinum-mode needs more space for line numbers (e.g., when line 100 is reached), the left margin disappears again, but this can be fixed by switching to another buffer and back again, or by splitting and unsplitting the window. Not perfect, but a livable work-around. This shouldn't be necessary very often, BTW.

2), when writeroom-mode is disabled, the line numbers disappear completely, even though nlinum-mode is still active. It needs to be disabled and reenabled to make the line numbers appear again. This is probably a bug in writeroom-mode which I'll try to fix ASAP.

jonkri commented 5 years ago

Would it be possible to adapt whiteroom-mode to not have the columns added by display-line-numbers-mode (included with Emacs 26) contribute towards the line length?

In other words, would it be possible to specify that whiteroom-mode should have, say, 80 characters long lines, excluding any characters added by display-line-numbers-mode?

Thanks!

joostkremers commented 5 years ago

In other words, would it be possible to specify that whiteroom-mode should have, say, 80 characters long lines, excluding any characters added by display-line-numbers-mode?

I just pushed an update to visual-fill-column-mode that should do that.