Emacs Hemingway mode

Well, there is no Hemingway mode. That is, there is no way to write like a novelist on a typewriter. On a typewriter the current line is always at the same place.

In long prose the typewriter experience is best. To achieve this in Emacs, there is a centered-cursor-mode.el somewhere on the internet, but this goes awry when you resize the text while the mode is active (in addition to other flaws and glitches that its author knows about and has documented in the Known Issues).

The solution I have found for now is a simplish

(add-hook 'post-self-insert-hook 'recenter nil t)

This creates the same main effect as centered-cursor-mode, but the cursor remains in place even when resizing the buffer text. The nil in the code makes it buffer-local.

To remove, apply remove-hook instead of add-hook. Also revert-buffer works to clear the hook in the buffer.

Leave a Reply

Your email address will not be published. Required fields are marked *