Creating Blot Journal entries using Emacs
Here’s the function I just wrote for creating new Journal entries in Blot:
;; Create Blot Journal post
(defun jab/blot-new-journal ()
"Create and visit a new draft journal post in Blot"
(interactive)
(let* ((default-directory (concat "~/Dropbox/Apps/Blot/[Journal]/"
(format-time-string "%Y/%m-%B/")))
(fpath (concat default-directory (format-time-string "%Y-%m-%d-") "journal.md")))
;; If folder doesn't exist, create it
(make-directory default-directory)
;; I use YAML metadata in Blot, even though it's not required.
(write-region (concat
"---"
"\ntitle: '" (format-time-string "%A, %B %d, %Y") "'"
"\ndate: " (format-time-string "%Y-%m-%d %H:%M:%S %z")
"\ntags: [\"\"]"
"\nsummary: "
"\ndraft: Yes"
"\n---\n\n"
"# " (format-time-string "%A, %B %d, %Y"))
nil (expand-file-name fpath) nil nil nil t)
(find-file (expand-file-name fpath))))
I could tidy and DRY that up, but it works.