I use text-mode-hook to activate darkroom-mode when I am in an org-mode buffer. This approach works quite alright, but I am struggling to make it work with another recent addition to my workflow, desktop.el.
I want to use desktop to save opened files, window and tab bar configurations. After some tinkering this works out fine, however, when I use desktop-read on a constellation that contains org-mode buffers, it seems like darkroom-mode is applied twice, i.e. the font is even bigger than with normal darkroom-mode applied.
I have tried to use desktop-after-read-hook to re-initialize darkroom-mode:
However, this does not seem to work, because the text still is oversized. If it were only for one tab or buffer where this is the case, I'd swallow that pill. However, it is the case in all org buffers, which is a tad too annoying with four tabs containing four different org files.
EDIT-1: I have found an approach involving ibuffer, selecting all buffers with a major mode that invokes darkroom-mode via ibuffer-mark-by-mode and then applying my fix via ibuffer-do-eval on those buffers. It is still way too manual for my tastes, but it will work for now.
EDIT-2: After some more research, I have now found a workable solution. It involves filtering the buffer by whether they are derived from text-mode (my criterion for applying darkroom). If they do, I apply my fix from above to them. The function is then called by the desktop-after-read-hook. Better than the other solution, I would still prefer one that doesn't require me doing stuff :P
Hej fellow(s),
I use
text-mode-hook
to activatedarkroom-mode
when I am in an org-mode buffer. This approach works quite alright, but I am struggling to make it work with another recent addition to my workflow,desktop.el
.I want to use
desktop
to save opened files, window and tab bar configurations. After some tinkering this works out fine, however, when I usedesktop-read
on a constellation that contains org-mode buffers, it seems like darkroom-mode is applied twice, i.e. the font is even bigger than with normaldarkroom-mode
applied.I have tried to use
desktop-after-read-hook
to re-initializedarkroom-mode
:However, this does not seem to work, because the text still is oversized. If it were only for one tab or buffer where this is the case, I'd swallow that pill. However, it is the case in all org buffers, which is a tad too annoying with four tabs containing four different org files.
EDIT-1: I have found an approach involving
ibuffer
, selecting all buffers with a major mode that invokesdarkroom-mode
viaibuffer-mark-by-mode
and then applying my fix viaibuffer-do-eval
on those buffers. It is still way too manual for my tastes, but it will work for now.EDIT-2: After some more research, I have now found a workable solution. It involves filtering the buffer by whether they are derived from
text-mode
(my criterion for applyingdarkroom
). If they do, I apply my fix from above to them. The function is then called by thedesktop-after-read-hook
. Better than the other solution, I would still prefer one that doesn't require me doing stuff :PHave a good day!