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.

Your Day on a Page

For many people, going to College means freedom. Freedom to try new things, to do what you like, when you like.

Well, not quite.

You’re still going to have  lectures and tutorials to attend (that’s why you’re going, remember?)  You want to make sure that you know what you’re doing every day, so that you can really enjoy your free time without worrying that you’re behind on an assignment.

That’s where Evernote can help you.

Evernote Home gives you your day on a page. Front and center should be your calendar. Your calendar will tell you where you need to be and when. Lectures, tutorials, practicals…

Setting up a calendar with all those details can be tedious. The good news is that 99% of the time your college will have your timetable already prepared and will share it with you via Google Calendar or Outlook. 

You can view that calendar on your home page on Evernote.  Here’s how you can add a Google Calendar. Evernote doesn’t support Outlook Calendar integration yet, but you can subscribe to your Outlook Calendar from your Gmail account. Scroll to the bottom of the page to see how.

Add your college calendar and when you open up Evernote in the morning you’ll have your day on a page before you.

But there’s more.

Searching is easy on Evernote, but why search when you can have the right notes appear at the right time?

Here’s a tip: link your study notes to your individual events.

Just suppose you’ve created a note with the materials you need for tomorrow’s 9am tutorial.  Link that note to the tutorial on the calendar on your Home Page. Here’s how to add link notes to calendar events.  Now the note will be there, just when you need it.

You can even get Evernote to remind you to open the notes as the lecture begins. Just go to Calendar settings (click the dots on the top right of the calendar widget).

If I only had two pieces of advice for people heading of to college, the above would be one of them. Follow this link to see the other…

Using Outlook

Using Outlook?  You can subscribe to your Outlook Calendar from your Gmail account, if your college allows you to share calendars.

  1. Go to Outlook and click on Settings (the cogwheel in the top right hand corner)
  2. Click on View all Outlook settings at the bottom
  3. Choose Calendar
  4. Choose Shared Calendars, just below Events from email. If Shared Calendars doesn’t appear then bad news, you’re college won’t allow this.
  5. Go to Publish a calendar and choose the calendar you want to share. Hit publish and copy the ICS link.  You
  6. Now open your Google Calendar
  7. Click on Cogwheel and Settings in the top right
  8. Choose Add Calendar and then From URL
  9. Enter the ICS link you copied earlier

Live Notes and Archives

Suppose every year I plan a birthday party for my good friend, Jean Petite.

I have separate notes containing lists of presents, guests, food and drink, entertainment and so on.  I also have one master note named Project: Jean Petite Birthday 2022.  All the notes are tagged jpbirthday so I can find them quickly.

The party is a success. Even so, I create a new note outlining what went wells and even better ifs that I can refer to when planning next year’s party.

What happens when next year comes around?  Do I create new notes or use old ones? 

Some notes such as guests will just need to be modified, but others like food and drink may have to be done from scratch. I’ll probably want to create a new note for presents, but retain the old note so I don’t buy the same gift twice.

How do I stop the current notes getting mixed up with the old ones?

One way is to tag the notes by year: 2020, 2021, 2022 and then just filter to this year’s party.

Here’s a better way.

Create the following notebooks (the numbers are there so they appear in the correct order in the sidebar)

Put this year’s party notes in the In Progress Notebook. Put previous years’ notes in the Done Notebook.  Put reference notes, notes that don’t really change from year to year, in the cabinet.

Notebook View

That way if you want to see this years notes, just filter to In Progress and jpbirthday.  To see only reference notes, filter to Cabinet and jpbirthday.  To see everything, just filter to jpbirthday

The system makes use of the fact that a note can only be in one notebook at a time. Notes can be Todo or In Progress, but never both at the same time. 

A lot of people recommend using tags to represent these states, I think they’re wrong.  I’ve written about that here: You’re Using Folders and Tags the Wrong Way Round

Two more things about this system.

The filtered notes widget works really well with this system.  You can use them to see this year’s party notes at a glance.

And lastly, I used to have a separate Archive Notebook for old notes.  This is no longer needed, they all just go in the Cabinet

Stop tagging your notes with todo and done. Use notebooks.

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.

You’re using folders and tags the wrong way round

According to Ian Small, CEO of Evernote, only 5% of Evernote users use tags. Evernote is not the only application that uses tags and folders, and I suspect the picture is similar in other applications. Most users rely on folders alone to categorize their work. I can understand this. Everyone has used paper folders in real life, the folders in applications replicate this experience.

However I think tagging is better, the reason being that although a note can only be in one folder, it can have more than one tag.

Here’s an example. Suppose you have personal notes and work notes. Some of those notes are just regular notes, some notes outline projects. You could tag your notes as follows:

  • Holiday (personal, project)
  • Shopping (personal)
  • User Manual (work, project)
  • Presentation (work)

Tagging like this gives you more flexibility. You can now filter for all of your projects, or filter for work projects only. By adding additional tags for things such as year 2021, 2022 you can then find, for example, all the personal projects you started in 2021.  Tagging gives your searches a granularity you don’t get by using folders.

Does that mean folders are no use? No. Folders are useful when something can only be on one state. A good example is :

  • Todo
  • In Progress
  • Done

You can set up those three folders and move notes between them. This is the opposite of the commonly recommended practice that you tag work with Todos.

Why are folders better? Because notes can only be in one folder at a time. It’s possible to accidentally tag a note as both Todo and Done. There’s also something quite satisfying about dragging a note from the In Progress to the Done folder…

What if you want to separate your work and personal to-dos? There are two ways. You can go to the Todo folder and filter by work or personal tags. Or it might be easier just to have two sets of folders

  • Work Todo
  • Work in Progress

And

  • Personal Todo
  • Personal in progress

Does it matter if you’re using folders and tags the wrong way round? Of course not. If you can find the right note at the right time, your system is fine. My suggestion is that using tags correctly adds flexibility.

7 GTD: Doing

  • If you’re not totally sure what your job is it will always feel overwhelmed
  • Lack of time is not the major issue. Things rarely get stuck because of lack of time, they get stuck because the doing of them has not been defined
  • You can’t do a project, you can only do the action steps it involves

It’s very easy to get caught up in your GTD system and to forget about the actual doing part.

Decide what to do according to the following four criteria:
– Context
– Time Available
– Energy Available
– Priority

If you’ve tagged your tasks properly you’ll have, for example:

Context: a list of phone calls to make when you’re on the phone, or emails to browse whilst sitting on a train

Time Available: A list of quick jobs to do when you have the odd five minutes

Energy Available: A list of jobs requiring little mental or creative horsepower

Priority: A calendar telling you what you must do today

I find it especially useful to tag the five minute jobs and the low energy jobs. I usually do the five minute jobs when I’ve got a little spare time before teaching a class, the low energy jobs can be fun things to read or enjoy.

Related Links