I maintain a daily journal in emacs using org-mode. I have been maintaining
this journal off-and-on since last year, and more consistently since April.
Primarily it contains my random thoughts about life in general or specific events of
the day. Also ledger source block for keeping track of my expenses (more on that
in later post)
After a while I started to realize, I needed some color in my journal entries. Previously when I used to keep a physical journal, I would put some hand drawn emojis or doodles on the pages.
Writing in org-mode or emacs in general is highly efficiently geared towards
plain-text. Editing, typesetting and adding visual content should be part of a
separate step in a workflow. This does not suite my use case of writing in a
journal. It is hard to justify doing multiple passes on something that is not
intended for publishing, In fact at rest the whole journal is encrypted. The
doodling aspect of it is also more creatively satisfying if done inline.
I own a Wacom Graphics tablet, that has been collecting dust for more than few years.
What I needed was a quick way to add a image to my org file, that would open
for editing in krita.
Unsurprisingly, someone else (lepisma) already faced similar problem. Enter
org-krita. The package is definitely at its infancy, and lot of the
configuration options are missing. But this solves my immediate problem.
I added the package in my doom Emacs’s packages.el
(package! org-krita
:recipe (:host github
:repo "lepisma/org-krita"
:files ("resources" "resources" "*.el" "*.el")))
Then enabled it in config.el
(use-package! org-krita
:config
(add-hook 'org-mode-hook 'org-krita-mode))
Now I can just M-x org-krita-insert-new-image, And voila, I have a image added
to my org-journal.
But I still needed something quicker. Let’s use yas-snippet as well.
# type: command
# key: ,kimg
# name: krita-image
# --
(let ((resource-dir
(cond ((org-entry-get-with-inheritance "res_dir"))
("./res/images")))
(description (org-roam--title-to-slug (read-string "Image title: " nil 'history "featured"))))
(insert "#+ATTR_ORG: :width 600px\n")
(org-krita-insert-new-image (concat (file-name-as-directory resource-dir) (format-time-string "%Y-%m-%d-%S-") description ".kra") description)
)
This reads title of the image from user, then creates the .kra file with today’s
date, in the folder specified by res_dir. e.g. ./res/images/2021-05-24-voila.kra
The res_dir property I have added as part of the journal file template
#+PROPERTY: res_dir ./static/images. Now I just need to go ,kimg <TAB> and
[[krita:./res/images/2021-05-24-voila][Voila]] gets added to the journal.
Unfortunately, org-krita is still missing some features. It uses the template
that is embedded inside the package. Would be nice if we could specify an
external template. Also while export to pdf seems to be working. I can not
figure out how to make it play nice with ox-hugo package, which I use for
writing this blog.