Skip to content

Commit

Permalink
Add org-journal-file-header
Browse files Browse the repository at this point in the history
Resolves #182
  • Loading branch information
ndw authored and casch-at committed Jan 11, 2020
1 parent 11b8255 commit 0f383d0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.org
Expand Up @@ -217,6 +217,8 @@ Customization options related to the journal file contents:

- =org-journal-time-prefix= - a string that will prefix every entry within a daily journal file.

- org-journal-file-header - a string that will be inserted at the top of every new journal file.

*** An example setup

A very basic example of customization.
Expand Down
10 changes: 10 additions & 0 deletions org-journal.el
Expand Up @@ -311,6 +311,11 @@ search works with regexps."
"If `t', journal entry dates will be cashed for faster calendar operations."
:type 'boolean)

(defcustom org-journal-file-header nil
"If non-nil, contents will be inserted at the top of new journal files.
If you define it as a function, it is evaluated and inserted."
:type 'string)

(defvar org-journal-after-entry-create-hook nil
"Hook called after journal entry creation.")

Expand Down Expand Up @@ -508,6 +513,11 @@ hook is run."
(unless (string= entry-path (buffer-file-name))
(funcall org-journal-find-file entry-path))

(if (and org-journal-file-header (= (buffer-size) 0))
(if (functionp org-journal-file-header)
(funcall org-journal-file-header)
(insert org-journal-file-header)))

;; Create new journal entry if there isn't one.
(let ((entry-header
(if (functionp org-journal-date-format)
Expand Down

0 comments on commit 0f383d0

Please sign in to comment.