Talking to myself with org-journal and Raycast

My working day involves tackling projects for a multitude of clients, as well as working on my own apps. My use of Org mode for managing projects and tasks prevents me from getting lost in the woods, but it can be difficult to remember exactly what I've accomplished in a day. It can be all too easy to think that you're not getting much done, even when apps are being published and new projects are being quoted for.

My latest attempt to celebrate what I've achieved each day - or give myself a stern talking to when I could have done more - is to try interstitial journaling. That is, whenever I start a task, make progress, or finish something, I'll log it in a journal.

I started off some time ago using Org-roam dailies. However, having a file per day and the lack of an easy way to see an overview of everything done in a week or month caused this to fall by the wayside. (It could be there is a way to configure Org-roam to do this - if so let me know!)

org-journal allows you to do something similar - but log into daily, weekly or monthly files. Exactly what I wanted!

Despite having been an Emacs user for a while, I always have to steel myself for messing with my configuration. Not that I don't enjoy writing Emacs Lisp - it's just that I'm scared I'll waste hours doing so for something that may not work out, and not be doing paid work or improving my own apps.

In the end, it didn't take that long, and I'm pleased with the result. So here is how I've got things working.

💡
Before you carry on reading I should say that I'm running Emacs on macOS, and use the Doom Emacs framework.

Installing org-journal

Package management in Doom is super simple. I added the following to .doom.d/packages.el, followed by a doom sync to perform the actual installation:

(package! org-journal)

Next came setting up org-journal to add entries to a monthly file, and editing .doom.d/config.el:

(use-package! org-journal
  :after org
  :config
  (setq org-journal-file-type 'monthly
        org-journal-date-format "%A, %Y-%m-%d"
        org-journal-file-format "%b-%Y-journal.org"
        org-journal-dir (concat org-roam-directory "/journal")
        org-journal-enable-agenda-integration t
        org-journal-date-prefix "* "
        org-journal-time-prefix "** "
        org-journal-file-header "#+title: %b, %Y Journal\n\n")
  (map! :leader
        :desc "New work journal entry"
        "j n" #'org-journal-new-entry)
  (map! :leader
        :desc "Open current journal file"
        "j o" #'org-journal-open-current-journal-file))

In addition to setting the date format, filename format, and ensuring each individual entry falls under the correct day, I added a couple of shortcuts for creating a new entry and opening the current month's file. I can now press <SPC> j n when I want to log something.

Getting Raycast in on the action

As much as I like using Emacs, much of the time I'm in Xcode or IntelliJ writing code. It would be jarring to switch back to Emacs to log a thought or change in task.

Raycast is easy to extend for my use case. I started off by adding a function into .doom.d/config.el:

(defun my/add-to-work-journal (text)
  (save-window-excursion
    (org-journal-new-entry nil)
    (insert text)
    (save-buffer)))

This will allow me to write a Raycast script to add to my journal file.

Here's the script:

#!/bin/bash

# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Add to work journal
# @raycast.mode silent

# Optional parameters:
# @raycast.icon 🤖
# @raycast.argument1 { "type": "text", "placeholder": "Journal entry text" }

# Documentation:
# @raycast.author Matthew Kennard
# @raycast.authorURL https://kennard.uk

escaped_entry=$(echo "$1" | sed 's/"/\\"/g')
emacsclient -e "(my/add-to-work-journal  \"$escaped_entry\")"
echo "Created work journal entry"

All it does is call emacsclient with the text I typed as my journal entry.

⚠️
Before passing the text emacsclient I'm quoting any double-quotes - otherwise you'll find that journal entries you enter in Raycast silently get ignored if they contain a "!

I can now bring up Raycast and type wj, press TAB and start writing.

Using my work journal script in Raycast

It's to be seen whether I'll stick with this system. However as I've reached the end of the week I'm enjoying reading back through everything I've done. I do feel as though I've accomplished more than I would do without this record. If you are an Emacs user and would like an easy way to track and review your week give it a go!