elisp - Emacs: Set writeroom mode as default -
elisp - Emacs: Set writeroom mode as default -
i new emacs , wondering if can set writeroom-mode on. want on start emacs , open new buffers or switch between them.
all help highly appreciated!
so you've provided link (albeit in your other question), can see library provides global minor mode turns on specific configurable set of major modes.
the next redefine function makes decision, if writeroom-major-modes
nil
(empty list), turn on any major mode.
i changed existing test check derived mode match, rather exact match. way default value of '(text-mode)
match not text-mode
, every mode derived text-mode
. not strictly relevant question, perhaps useful if find "all modes" approach overkill.
(eval-after-load 'writeroom-mode '(defun turn-on-writeroom-mode () "turn on `writeroom-mode'. function activates `writeroom-mode' in buffer if buffer's major mode fellow member of `writeroom-major-modes', or derived 1 of modes. if `writeroom-major-modes' nil, activate `writeroom-mode' in buffers." (when (or (not writeroom-major-modes) (apply 'derived-mode-p writeroom-major-modes)) (writeroom-mode 1))))
whether need explicitly load/require library depends on how you've installed it; you're using library already, that's presumably been taken care of, meaning it's case of:
class="lang-el prettyprint-override">(global-writeroom-mode 1)
alternatively (to of above), ignore global mode provided, , create own alternative global minor mode, described in how enable non-global minor mode default, on emacs startup?
edit: i've had bit of play writeroom-mode
, , seem there reasons why global mode bit conservative. might still find "derived mode" improvement useful, suspect trying create particular mode 100% global not going work @ all.
emacs elisp emacs24
Comments
Post a Comment