Getting Around in Doom Emacs

The following post is part of my new Emacs Writing Setup. You can find the complete setup here on GitHub: https://github.com/ballantony/emacs-writing


A big part of writing is putting the notes I’ve made into some sort of order. I spend a lot of time joining notes together to make scenes and then rearranging those scenes. Scrivener is good at the rearranging part (I’ve written about this here.) Where Scrivener falls down is the flexibility of search. Emacs allows me to home in on a scene, an idea or a sentence almost instantly.

I copied some of my writing process from Scrivener’s model, even going as far as writing a simple Emacs Scrivener mode. Doom Emacs has rendered that unnecessary. Tools like ripgrep and consult make it far quicker to find what I’m looking for. If you’re unfamliar with the following commands, try them out. You’ll be pleased that you did.

One last thing. Doom Emacs calls different commands depending on which completion engine you’re using. This means the search syntax may vary. I use the default (vertico at the time of writing) which means that searching for apples oranges will return lines containing apples and oranges. In other words: when searching, type one word for an initial selection, then a second to narrow it down.

10.0.1 Searching in Projects

  • SPC SPC find file in project
  • SPC s p search project for text
  • SPC s P search another project for text
  • SPC s d search files in directory for text

10.0.2 Searching in Buffers

  • SPC s s helper function search for text in current buffer. Matches are displayed in another window.
  • SPC s j helper function that goes to entry in evil’s jump list
  • SPC m . Jump to org heading (uses consult-org-heading)

And don’t forget

  • C-c C-j org-goto

10.0.3 Useful Tips

  • SPC s o Search online. t will search online dictionary, T thesaurus
  • Find an unmatched quote using this regex ^[^"]*"[^"]*$

10.0.4 M-x consult-ripgrep

For a more flexible search try consult-ripgrep. It’s worth reading the documentation, but here’s a taste:

  • #alpha beta Search for alpha and beta in any order.
  • #alpha.*beta Search for alpha before beta.
  • #\(alpha\|beta\) Search for alpha or beta (Note Emacs syntax!)
  • #word -- -C3 Search for word, include 3 lines as context
  • #first#second Search for first, quick filter for second.

Todos and Agenda Views

The following post is part of my new Emacs Writing Setup. You can find the complete setup here on GitHub: https://github.com/ballantony/emacs-writing


On my original Emacs Writing Set Up I had this many states:

(setq org-todo-keywords
      (quote ((sequence "TODO(t!)"  "NEXT(n!)" "|" "DONE(d!)")
              (sequence "REPEAT(r)"  "WAIT(w!)"  "|"  "PAUSED(p@/!)" "CANCELLED(c@/!)" )
	      (sequence "IDEA(i!)" "MAYBE(y!)" "STAGED(s!)" "WORKING(k!)" "|" "USED(u!/@)"))))

Now I only have three: TODO, IN PROGRESS and DONE

This is in line with my philosophy that productivity systems are great procrastinators. Thinking of new tagging systems and states for tasks is very absorbing. You can spend hours moving notes around and not doing any work.

Now I capture all my notes as TODOs, I change their state to IN PROGRESS and DONE as projects advance.

Calling org-agenda gives me a bird’s eye view of everything I’m working on. I can then filter down as appropriate.

For convenience, I wrote the following function to restrict the agenda to the current project. ou can see an example in my config.el file

(defun tb/agenda-restrict-this-project ()
    "Restrict agenda to current project"
    (interactive)
    (let ((org-agenda-files (list (projectile-project-root))))
      (org-agenda)))

I rely a lot on this function. When writing I hit SPC j p p (my keybinding: see my config.el file) to see the TODOs and IN PROGRESSes for the current project only.

You can read more in My Doom Emacs Writing Set Up

Capturing and Refiling Notes

The following post is part of my new Emacs Writing Setup. You can find the complete setup here on GitHub: https://github.com/ballantony/emacs-writing

Capturing Notes

Like any writer I’m always capturing ideas. I used to carry a notebook everywhere, now I capture ideas on my phone using either orgzly or Evernote.

When working in Emacs I use org-capture.

GTD means capturing ideas quickly. I used to have templates to capture to different locations, I realised that this was an unnecessary step. Now I either capture everything as a TODO, either directly to my gtd file, or directly to the story file I’m currently working on.

As org-capture requires you to select a template I wrote the following two functions. The first calls org-capture with the ’t’ template preselected, the second does the same but uses let* to change org-capture-templates to the current buffer for the current capture only.

(defun tb/capture ()
    "Capture to do without options"
    (interactive)
    (org-capture nil "t"))

  (defun tb/capture-to-this-buffer ()
    "Capture note to this buffer"
    (interactive)
    (cond  ((not  (eq major-mode 'org-mode))
            (message "Can't capture to non org-mode buffer"))
           (t
            (let* ((this-file buffer-file-name)
                   (org-capture-templates
                    `(("t" "Todo" entry (file+headline ,this-file "Captured")
                       "** TODO %?"))))
              (org-capture)))))

2. Refiling Notes

org-refile makes it easy to refile notes, particularly with a completion system like Vertico. On Doom Emacs this means hitting SPC m r r

Why Doom Emacs?

Way back in September I posted about my new Emacs Writing Set Up: Productivity Overview

Things might have appeared to have gone a little quiet since then. Behind the scenes, however, I’ve been making changes. One of these is to begin the process of moving my Emacs Writing Setup across to GitHub: https://github.com/ballantony/emacs-writing.

I’ll continue to blog relevant content here. Here’s the first, explaining why I’ve adopted Doom Emacs.


Emacs is incredibly configurable. I can choose, for example, the shape and contents of my agenda, the completion engine I use and even such things as the colour of my Todos.

And that’s a problem. Emacs allows me to configure many things that, if I’m honest, I really don’t care about.

It’s very easy to fall into the Emacs trap of sending time configuring the system rather than doing any actual work. I don’t want to think about how many hours I’ve spent experimenting with new packages and thinking of the perfect key bindings when I could have been writing stories instead. GTD can be a powerful procrastinator.

That’s why I’m happy to let someone else do it for me.

Enter Doom Emacs. So what if the TODOs are a different colour to the ones I use, and the capture templates aren’t quite the ones I was using, they’re still good. The key bindings may be different, but they’re far more extensive than any I’ve ever set up and I could probably finish a short story in the time it would take me to replicate them (and I can always override the few I really care about: C-e for example).

Most of all, Henrik Lissner, the creator of Doom Emacs, knows so much more about Emacs than I. I’ve learned so much simply tracking through his code. I wasn’t aware of Vertico until it turned up in the Doom config. I don’t have the time or inclination to try out all new Emacs packages. It’s great that someone else is doing this, and if I don’t like their choices, well, Doom is flexible enough for me to change them.

One final observation. Doom Emacs is fast to load. This is important to me. I like to take notes or begin writing when inspiration strikes. I can open Doom Emacs (or Orgzly on my mobile phone) and take a note in the time it takes apps such as Evernote or Notion to load.

Productivity Overview

My second most popular post ever describes my Emacs Writing Setup. (My most popular post, if you’re interested, is this one.)

I wrote five novels and about thirty short stories using the method described in my Emacs Writing Setup, all the while experimenting with other methods. For example, I replicated some Scrivener features in Emacs and wrote about them here.

But over the past year all this has changed. So much so that I’m rewriting my Emacs Writing Setup from scratch.

So what’s changed? Briefly, I’ve started using org-roam and Doom Emacs for my writing flow. This has had a knock on effect for my productivity flow in general.

I think that I’m a productive person. I’m an assistant head teacher. I’ve had 8 novels and around 70 short stories short stories published. I maintain three blogs. I play jazz piano, accordion and baritone horn and am a member of two bands. Most importantly I’m a husband, carer and father to two children.

My two secrets? I watch very little TV and I rely heavily on productivity systems. I think if you’re not using a system then you’re not meeting your full potential.

The systems I use are GTD and Zettelkasten. I’ve experimented with others, but these are the two that best match my needs and personality.

I’ve also experimented with various software applications over the years. I’ve yet to find one piece of software that meets all my needs, although Emacs comes close. If I were to work solely on a laptop, that’s all I would use, but like most people I also rely on a phone and browser.

Orgzly and beorg do a good job of replicating the Emacs experience on a phone, but Emacs without a proper keyboard is always unsatisfying. And, as yet, I’ve not found a satisfactory way of using Emacs via a browser.

So my current productivity system relies on three ‘applications’

  • Emacs
  • Evernote
  • Notebook and pen (I use Leuchtturm1917 notebooks and Uniball Jetstream pens for preference)

I use Emacs for most things, principally org-mode for writing and org-roam for Zettelkasten

Why do I use Evernote when I have Emacs? Remember, Zettelkasten is a tool for thinking, it’s not a reference tool. One of the principles of Zettelkasten is that you should separate your notes from your reference materials.

Evernote is ideal for reference, it’s also more suited for phone and browser access. The newly added Evernote Tasks feature goes some way to replicating org-agenda. Okay, it’s got a long way to go to match Emacs but I can live with it for the convenience. (I experimented with Todoist for a while before Evernote tasks came out. I liked Todoist so much I almost feel guilty for not using it. It’s an excellent piece of software, but I like to have all my to dos in one place)

Finally, I use a notebook for ideas and thinking things through.

As word documents are the de facto standard in the publishing world , I still use LibreOffice Writer for submissions and editing, but I would say that I spend 99% of my time on Emacs, Evernote and in my Notebook.

This series of posts describe how I use these Emacs, Evernote and my notepad to implement GTD and Zettelkasten, particularly to support my writing process. As I don’t have the patience to watch videos, as I’m not interested in personal anecdotes or dubious research to support self evident points I won’t be including any of those things here. I will include How Tos and config files for those who are interested.

If there’s anything missing, let me know.

Productivity 2021

My second most popular post ever describes my Emacs Writing Setup. (My most popular post, if you’re interested, is this one.)

I wrote five novels and about thirty short stories using the method described in my Emacs Writing Setup, all the while experimenting with other methods. For example, I replicated some Scrivener features in Emacs and wrote about them here.

But over the past year all this has changed. So much so that I’m rewriting my Emacs Writing Setup from scratch.

So what’s changed? Briefly, I’ve started using Zettelkasten, org-roam and Doom Emacs for my writing flow. This has had a knock on effect for my productivity flow in general.

Over the next few months I’ll be going over my new set up. Let me know what you think.