Quick journaling in org-mode in Emacs

March 24, 2024
emacs elisp programming org-mode

A while back I started maintaining a journal, it can contain things that I’ve learned like new programming techniques, new commands, new insights, …etc. The key for me to make this viable is to be low-friction, so I’ve written an Emacs Lisp script that opens a journal in my journal directory with today’s date as the filename, so whenever I want to write something, I just hit Ctrl-x-j in emacs, write what i want and move on. And later on, if I want to check something in my journal e.g. an obscure command, I can just grep my journal directory.

Here’s the elisp code that does that:

(defconst journal-path "~/personal/notes/journal/")

(defun get-today-filename ()
  (concat journal-path (format-time-string "%d-%m-%Y") ".org"))

(defun today-journal ()
  "Open today's journal."
  (interactive)
  (let ((fname (get-today-filename)))
    (find-file fname)))

(keymap-global-set "C-x j" 'today-journal)