Skip to content

Instantly share code, notes, and snippets.

@mlabbe
Created December 6, 2025 19:52
Show Gist options
  • Select an option

  • Save mlabbe/0ba4183ba425985ed2caeb4f6717502c to your computer and use it in GitHub Desktop.

Select an option

Save mlabbe/0ba4183ba425985ed2caeb4f6717502c to your computer and use it in GitHub Desktop.
Microjournal
(defcustom microjournal-path "~/.journal.org.gpg"
"name for the microjournal file"
:type 'file
:group 'microjournal)
(defun microjournal-insert-year ()
"Create a root header for the current year if it doesn't exist"
(interactive)
(let ((header-name (format-time-string "%Y")))
(goto-char (point-max))
(unless (re-search-backward (format "^\\*+ %s" header-name) nil t)
(insert (format "\n* %s\n" header-name)))
(org-show-subtree)))
(defun microjournal-new-entry ()
"Create a new entry for the current time and day"
(interactive)
(progn
(find-file microjournal-path)
(microjournal-insert-year)
(org-insert-heading-respect-content)
(org-do-demote)
(insert (format "%s\n" (format-time-string "%A, %m/%d/%Y %I:%M%p")))
))
(provide 'microjournal)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment