It should be as simple as specifying the file variables at the top of your file. However, it's not. I suspect you're getting stuck on what variables.
The following enables
olivetti mode, but doesn't seem to set the width properly:
;; -*- mode: olivetti; olivetti-set-width: 110; -*-
Such a line at the top of the file specifies file variables. Since
olivetti-set-width is a function, not a variable, the line above doesn't work how we want it to.
So, what variable does
olivetti-set-width set? Looking at
C-h f olivetti-set-width and peeking at the source code yields
olivetti-body-width. However, the following doesn't work for me either:
;; -*- mode: olivetti; olivetti-body-width: 110; -*-
I'm not sure why it doesn't work as expected. It probably has something to do with when file variables are assigned. I do notice that calling
(setq olivetti-body-width 110) after the buffer has loaded changes the width. If the mode has a hook, we could just call it after the mode is loaded. Checking
C-h olivetti--hook, I find
Put the following at the top of any documents you want to open in
olivetti mode. This will enable
;; -*- mode: olivetti; -*-
init.el, put the following. This will change the body width whenever
olivetti mode is enabled.
(add-hook 'olivetti-mode-hook (lambda () (interactive) (setq olivetti-body-width 110)))