Making progress on NaNoWriMo, and a GNU Emacs tutorial

I’m making good progress on my novel for National Novel Writing Month, about my participation in which I’ve previously blogged. Incidentally, that previous sentence is a good example of why it isn’t a good idea to always obey the “no prepositions at the end of a sentence” rule, a rule I’m planning to make lots of violations of.

And now for something completely different. I’m writing my novel entirely on the command line in GNU Emacs. Why? Because I can. Oh, and because it allows me to work on my novel from anywhere with Internet access, as all I need to do is just ssh in. Thus I don’t have to worry about only being able to write from one computer, or having to carry around my novel as a file with me. Unfortunately, GNU Emacs is optimized for editing computer code. The default way it treats long lines isn’t very friendly to prose; it wraps on any character instead of only on spaces, and movement across long lines is unpleasant. Luckily it can be customized. Here’s the code I added to the .emacs file in my home directory. Modify (or create) yours accordingly and you can be writing long-form prose on the command line in no time.

;; Create a new minor mode called story-mode that will be
;; automatically loaded any time a text file with the .story extension is opened.
(add-to-list 'auto-mode-alist '("\\.story\\'" . text-mode))
;; Set longlines-mode to load as a hook whenever the text-mode minor mode is activated.
(setq text-mode-hook '(longlines-mode))
;; Set it so that the line length at which long lines wrap is adjusted to the size of the window.
(custom-set-variables '(longlines-wrap-follows-window-size t))

If you have GNU Emacs version 22 or higher, that’s it, you’re set up! Longlines-mode is included. If you have an older version of Emacs, you’ll need to download longlines mode separately. This configuration sets the mode to only fire automatically for files named *.story. If you want to use longlines mode for other types of files, either adjust your configuration accordingly, or load it manually on a case-by-case basis.

2 Responses to “Making progress on NaNoWriMo, and a GNU Emacs tutorial”

  1. Darmok Says:

    I agree that there’s no reason to always avoid prepositions at the end of the sentence. But that second sentence should probably have been recasted (though yes, I realize you were deliberately distorting it for humor).

  2. Cyde Weys Says:

    What reason should I have recasted my second sentence for?