Closed juacq97 closed 4 years ago
Hm, issue #62 seems to be about the exact same problem. It could be that writeroom-mode-disable-hook
is called in the wrong context, but I'll need a bit more time to look into this than I have right now. I'll try to get back to this in a few days.
Hi, my apologies it took so long, but I think I've now been able to fix this issue. The problem turns out to be that minor mode hooks are also run when a minor mode is disabled. So activating variable-pitch-mode
in writeroom-mode-hook
has the effect that variable-pitch
is activated again right after it was deactivated in writeroom-mode-disable-hook
.
I've added a hook writeroom-mode-enable-hook
which only gets run when writeroom-mode
is enabled, so you could use that instead of writeroom-mode-hook
. But I also added a user option writeroom-local-effects
, which can be used instead:
(add-hook 'writeroom-local-effects 'variable-pitch-mode)
Functions in this "abnormal" hook are called with the argument 1
when writeroom-mode
is enabled and with -1
when it is disabled, so you can just drop some minor mode on it and it will be handled correctly.
Thanks for reporting this bug and please let me know if you still run into problems.
Hi! I want to change the font to a proportional one instead of the mono font I normally use when I run writeroom-mode, so I tried this:
When I enable
writeroom-mode
the font change as expected, but when I disable it, the font remains, I need to manually disablevarible-pitch-font
. I tried to disable the line numbers too, but the same happens, the numbers dissapers whenwriteroom-mode
is enabled, but don't return whenwriteroom-mode
is disabled. I'm doing something wrong with thewriteroom-mode-disable-hook
? Thanks!!