I am new to emacs and I am wondering if I can set the writeroom-mode to always be on. I want it to be on as I start up emacs and as I open new buffers or switch between them.
All help is highly appreciated!
If write-room
mode is a globalized minor mode, then just turn it on in your init file.
If write-room
mode is a minor mode and there is no globalized version of it, you can use define-globalized-minor-mode
to define such a globalized mode. Then turn that on in your init file.
If write-room
is a major mode then you can customize option auto-mode-alist
to turn it on for any number of file-name extensions.
If write-room
is an ordinary function (not a major-mode function) then you can automatically turn it on by using add-hook
to add it to the major modes you use.
And yes, if you specified what write-room
is (in Lisp terms) then answering your question would be easier.
So now that you've provided a link (albeit in your other question), I can see that the library provides a global minor mode which only turns itself on for a specific configurable set of major modes.
The following will redefine the function which makes that decision, so that if the
writeroom-major-modes
isnil
(empty list), it will turn on for any major mode.I also changed the existing test to check for a derived mode match, rather than simply an exact match. That way the default value of
'(text-mode)
would match not onlytext-mode
, but every mode derived fromtext-mode
. Not strictly relevant to your question, but perhaps useful if you find the "all modes" approach overkill.Whether you need to explicitly load/require the library depends on how you've installed it; but as you're using the library already, that's presumably been taken care of, meaning it's then just a case of:
Alternatively (to all of the above), you could ignore the global mode provided, and create your own alternative global minor mode, as described in How to enable a non-global minor mode by default, on emacs startup?
Edit: Well I've had a bit of a play with
writeroom-mode
, and it would seem there are very good reasons why its global mode was a bit conservative. You might still find the "derived mode" improvement useful, but I suspect trying to make this particular mode 100% global is not going to work very well at all.