2

I was just wondering if there is a way to create a standard set of sections for my daily journal entry. So if I want a section for Todos, and another section for meetings, etc. Is it possible to just create a standard template in emacs that gets built when a new journal file is created?

UPDATED TO CLARIFY:

I just wanted to clarify any ambiguity. Org-journal will create a new empty journal file for each day. The file is usually named with the date, so "20151106". The file is empty when it is created.

So I wanted to create a set of org bulletted sections that were created in the new file. So they should include:

  • Tasks
  • Exercise
  • Meal Plan

That way I don't have to manually create these each time a new journal entry is created.

2

I have a hack that uses a hook on org-journal-after-entry-create-hook to insert a daily template

  (defun pc/new-buffer-p ()
    (not (file-exists-p (buffer-file-name))))

  (defun pc/insert-journal-template ()
    (let ((template-file (expand-file-name "template.org" org-directory)))
      (when (pc/new-buffer-p)
        (save-excursion
          (goto-char (point-min))
          (insert-file-contents template-file)))))

  (add-hook 'org-journal-after-entry-create-hook #'pc/insert-journal-template)
1

Updated answer

Here's a capture template that will get you started. You may want to change org-directory into the directory where you want to store the journal files.

(setq org-capture-templates '(("j" "Journal" entry (file
                                                (expand-file-name (concat (format-time-string "%Y%m%d") ".org") org-directory))
                           "* Tasks%?\n* Exercise\n* Meal plan")))
  • Hey @Erik thanks for trying to help. Sorry I was ambiguous. I tried to clarify the OP above. I need is to create a template for an org-journal entry and then save new capture requests to the current org-journal entry. Let me explain. So org-journal will create a new empty file for each day with the C-c C-j keystrokes. On creation of the new journal entry, I would like these sections created in the current journal entry file--so I can't hard code the filename for the capture template--as you did above with "myfile.org." Let me know if anything is still unclear, and thanks again for your help. – krishnab Nov 6 '15 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.