joostkremers / writeroom-mode

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

Top margin #8

Closed petrux closed 10 years ago

petrux commented 10 years ago

Just a (minor) enhancement. When opening buffer in writeroom-mode it would be nice to have a three lines top margin.

joostkremers commented 10 years ago

Emacs doesn't provide the option of a top (or bottom) margin similar to the left and right margins. I looked into ways of creating something that has a similar visual effect, but there doesn't seem to be something that's robust enough to add to a package such as writeroom-mode.

So unless I stumble upon a better method, I'll have to leave this one unimplemented.

joostkremers commented 10 years ago

Ok, ignore last comment... There appears to be a way to sort-of do this. I added a new global effect "Add border" which adds a border around the text area. That should provide more or less what you want and should be robust. It is disabled by default, but you can enable it in the user option writeroom-global-effects. The width of the border is controlled by writeroom-border-width, which defaults to 30 (it's a value in pixels).

petrux commented 10 years ago

Great! Already on Marmalade?

joostkremers commented 10 years ago

Melpa. :-) But yes, it is.

BTW, packages on Melpa are updated automatically from the source repository. The maintainer doesn't need to do anything for that. So normally you only need to wait a bit (usually just a few hours) for updates to appear on Melpa.

petrux commented 10 years ago

Melpa, right! :-)
Ok, sorry for my dumbness and for the question I'm about to ask: how can I activate/customize the mode effects? Thanks!

EDIT: got it, it's just M-: (writeroom-toggle-internal-border-width 1). Anyway, I think I discovered a couple of bugs.

joostkremers commented 10 years ago

EDIT: got it, it's just M-: (writeroom-toggle-internal-border-width 1). Anyway, I think I discovered a couple of bugs.

No, that's not the best way. The recommended way is to use the Emacs' Customize interface:

M-x customize-group RET writeroom RET

Open the option "Global Effects" and check the box "Add border".

pheraph commented 5 years ago

I'd like to achieve a top margin, but the described method isn't working for me. I activated "Add border" and set the border width, but still don't see a top margin (padding).

 '(writeroom-border-width 100)
 '(writeroom-global-effects (quote (writeroom-set-internal-border-width))
joostkremers commented 5 years ago

It's working fine for me (Emacs 26.2). What effect exactly are you expecting? All that happens is that there is a larger space between the frame edge and the text. This is a screen shot with "Add border" active and a border width of 100 pixel:

Screenshot from 2019-04-22 23-59-28

And this is without "Add Border":

Screenshot from 2019-04-22 23-59-52

pheraph commented 5 years ago

Yes, that's exactly what I wanted to achieve. Anyway, I removed all writeroom specific settings from my config file and reconfigured them from the GUI and now it's working fine.