Writing in Emacs
The excellent YouTube video called "Emacs for Writers" tells the story of how a writer learned about Emacs because he wanted a simple writing tool that helped him focus on what he was writing.
I have (barely) used Scrivener and other tools (including just a set of LaTeX files) to write larger texts. However, I wanted to set something up more along the lines of what the Jay Dixit in the above video has set up.
Here's what I've got so far.
All of this is designed for writing in .org files using org-mode. Org-mode is great for writing because you can show/hide your text vs. the headers/outline of your text. There are lots of other things that org-mode could do, such as tracking to-do's, but at its most basic you're writing text inside headings.
Some quick things that you get "for free" with org-mode include:
- export options built in for HTML, PDF, text, or other formats
- comments that aren't rendered in your final version, e.g. you can have notes to yourself that people don't see when you export your writing
- contents are all text so it's easy to make large-scale changes with tools as simple as find and replace
(use-package org-panes :ensure nil :config (setq org-panes-split-overview-horizontally t) (setq org-panes-main-size 70))
org-panes is a module to give you a three-pane view:
- The top-level headings of your document
- All headings of your document
- The actual text of your document (the main pane)
If you select a different heading in the summary panes, you're taken to the relevant section in the main pane.
Olivetti will narrow the window so that you have larger margins rather than writing right up to the edges of the window. I like how this helps me focus on what I'm writing.
Word count goal mode
This minor mode shows you how many words are in the buffer vs. when you first opened the buffer, in the form
I am therefore looking at the mode line more. So, I also learned about
diminish, which is a tool to hide things from your mode line. This tool is supported by use-package. For example, I know I'm using Helm so I don't need to see it in my mode line anymore:
(use-package helm :diminish ; ... )
; "C-c f" turns olivetti on/off, globally. (use-package olivetti-mode :ensure nil :bind ("C-c f" . olivetti-mode)) ; org-panes and olivetti don't play well together ; because they both change window sizes. this function ; turns olivetti-mode off first if it's on, so that ; org-panes doesn't get confused about the window size (defun org-panes-check-olivetti () (interactive) (if (bound-and-true-p olivetti-mode) (progn (olivetti-mode -1) (org-panes) (olivetti-mode)) (org-panes))) (use-package org ; bunch of other stuff goes here :bind (; other bindings go here :map org-mode-map ("C-c p" . org-panes-check-olivetti) ; etc
I wanted two key bindings:
C-c f, set globally, for "focus." This turns Olivetti on and off.
C-c p, set within org-mode buffers, for "panes." This turns org-panes on and off.
file mode lines
# -*- mode: org; eval: (wc-goal-mode); -*-
I am still experimenting with file-specific mode lines. For the one larger file I am writing in, I turn on wc-goal-mode by default using the above "eval" line.
Lessons learned and next steps
I am weighing whether it's a good idea to create a specific frame layout for writing–one that not only has org-panes but specifies specific fonts/sizes for each window.
I'm also potentially interested in capturing word count by day, maybe with an external script. Right now I'm doing this manually via a Makefile (of course):
word-count: (/bin/echo -n $$(date); pandoc file.org -w plain | wc -w ) >> file-word-count.txt
This adds a line to the file
file-word-count.txt whenever you run it, showing the date, time, and current word count according to pandoc's conversion of the file into plaintext.
Sun Feb 24 13:05:25 PST 2019 2152 Sun Feb 24 17:02:08 PST 2019 3245