Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add org-journal-file-header #184

Closed
wants to merge 1 commit into from
Closed

Add org-journal-file-header #184

wants to merge 1 commit into from

Conversation

@ndw
Copy link
Contributor

ndw commented Jan 10, 2020

Fix #182

This PR adds an org-journal-file-header string that is inserted at the top of new journal entries. If the value is a function, the result of evaluating the function is inserted. FWIW, here's my experimental configuration for weekly journals:

(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))))

(customize-set-variable 'org-journal-file-header
   (lambda ()                        
     (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"))))
cslux added a commit that referenced this pull request Jan 11, 2020
@cslux

This comment has been minimized.

Copy link
Collaborator

cslux commented Jan 11, 2020

Integrated into master.

@cslux cslux closed this Jan 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.