Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
I've been creating daily journals for a while now, but in practice, I create a summary for every week. On the one hand, that's a good opportunity to synthesize the work of the week. On the other hand, I wouldn't have to cut and paste quite so much if I just kept a weekly journal.
So I'm thinking of switching to weekly.
But if I did that, I think I'd want to have a preamble:
On a casual inspection of the code, it didn't seem like this was configurable today. It's also not entirely clear if the extra headers would introduce any problems. I don't think they would, but...
Is this something you think could be made to work?
Hmm. Actually, this can already be done with
(defun org-journal-date-format-func (time) "Custom function to insert journal date header, and some custom text on a newly created journal file." (concat (when (= (buffer-size) 0) (concat (format-time-string (pcase org-journal-file-type (`daily "#+TITLE: Daily Journal, %A, %x") (`weekly "#+TITLE: Weekly Journal No. %V, %Y") (`monthly "#+TITLE: %B Journal, %Y") (`yearly "#+TITLE: %Y Journal"))) "\n")) org-journal-date-prefix (format-time-string "%A, %x" time))) (setq org-journal-date-format #'org-journal-date-format-func)
In your case.
(defun ndw/org-journal-monday (&optional time) "Return the TIME cast back to the previous Monday. If TIME isn’t specified, the (current-time) is assumed. If today is Monday, return today." (let* ((now (if time time (current-time))) (dow (string-to-number (format-time-string "%u" now))) (delta (if (= dow 1) 0 (* (- dow 1) (* 24 3600))))) (seconds-to-time (- (time-to-seconds now) delta)))) (setq org-journal-date-format (lambda () (concat (when (= (buffer-size) 0) (let ((monday (ndw/org-journal-monday))) (insert "#+TITLE: ") (insert (format-time-string org-journal-date-format monday)) (insert "\n#+STARTUP: showeverything\n#+FILETAGS: :Journal:\n\n"))) org-journal-date-prefix (format-time-string "%A, %x" time))))