0

I have been trying to set up org-journal. Initially, I set up the config using (require 'org-journal):

(setq org-journal-dir "~/org/meta/journal/")                     
(setq org-journal-date-format "%A, %d %B %Y")                    
(setq org-journal-file-format "%d-%m-%Y.org")                    
(setq org-journal-file-type "weekly)")                           
(require 'org-journal)

This seemed to work for the first day but the variables were subsequently not set. I changed to trying use-package:

(use-package org-journal                                            
  :ensure t                                                         
  :defer t                                                          
  :init                                                             
  ;; Change default prefix key; needs to be set before loading org-journal                                                             
  (setq org-journal-prefix-key "C-c j ")                              
  (setq org-journal-date-format "%A, %d %B %Y")                     
  (setq org-journal-file-format "%d-%m-%Y.org")                     
  (setq org-journal-file-type "weekly)")                            
  :config                                                           
  (setq org-journal-dir "~/org/meta/journal/"                       
        org-journal-date-format "%A, %d %B %Y"))

I am getting variations upon the following error:

[from *Messages*]

org-journal--search-forward-created: Search failed: "[  ]*:CREATED:[    ]+20200922[     ]*$"

[and full backtrace]:

Debugger entered--Lisp error: (search-failed "[ \011]*:CREATED:[ \011]+20200922[ \011]*$")                                               
  re-search-forward("[ \011]*:CREATED:[ \011]+20200922[ \011]*$" nil nil nil)                                                            
  org-journal--search-forward-created((9 22 2020))                                                                                       
  org-journal--goto-entry((9 22 2020))                                                                                                   
  org-journal--open-entry(t t)                                                                                                           
  org-journal--carryover()                                                                                                               
  org-journal-new-entry(nil)                                                                                                             
  funcall-interactively(org-journal-new-entry nil)                                                                                       
  call-interactively(org-journal-new-entry nil nil)                                                                                      
  command-execute(org-journal-new-entry)

A new journal buffer is opened entitled 23-09-2020.org (ie. in the journal directory there is a file '#23-09-20920.org#'). There is an existing file in the journal directory entitled 22-09-2020.org. This first file (the first journal entry I created yesterday when I set file-type to weekly entries) contains a string ":CREATED: 20200922", which, though I don't understand all of the formatting, or indeed the syntax, re-search-forward appears to be searching for. Creating a new journal entry worked yesterday ie. I created several entries which correctly appended, with timestamp, to the 22-09-2020.org file, but fails as above and creates a new file today. This is so when ran from F5 (currently globally mapped to org-journal-new-entry), M-x org-journal-new-entry, or C-c C-j.

I thought briefly (because initially, the file-type was set to daily), that org-journal-invalidate-cache might solve it but it has no evident effect.

My elisp is poor to non-existent but looking over the code, I wonder if the problem is related to the function (org-journal--convert-time-to-file-type-time). This ought to return the first day of the week and does not appear to be doing so. The first entries in an empty directory having invalidated the cache always create a file for the present day, not the first day of the week, though org-journal-file-type is set to "weekly".

I would appreciate any constructive pointers.

1
  • A little additional detail: entries are correctly appended with a timestamp when I delete entries in the journal folder, call (org-journal-invalidate-cache), begin a new journal, close it and add additional entries by calling (org-journal-new-entry) on the same day. Subsequently (org-journal--get-entry-path) returns a path built from today's date and not the week's first entry. The path is built correctly ie. it searches for 03-10-2020.org when it ought to be targetting the first entry 02-10-2020.org and searching within it. org-journal-file-type is reported as being set to "weekly". – krozruch Oct 3 '20 at 19:59

Your Answer

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

Browse other questions tagged or ask your own question.