bastibe / org-journal

A simple org-mode based journaling mode
BSD 3-Clause "New" or "Revised" License
1.24k stars 123 forks source link

Weekly journal search feature doesn't work #358

Open DominikMendel opened 3 years ago

DominikMendel commented 3 years ago

Describe the bug I am using a weekly journal for my work. Org-journal-search-forever doesn't work. I have narrowed it down to org-journal--list-files returns nil.

To Reproduce Steps to reproduce the behavior: Run org-journal-search-forever with a string in a weekly journal.

Expected behavior Results should be found.

Screenshots N/A

Desktop (please complete the following information):

Your Emacs Configuration The part relevant to org-journal. (setq org-journal-dir "~/Dropbox/org/journal" org-journal-date-format "%A, %d %B %Y\n" org-journal-file-type 'weekly org-journal-file-format "%Y%W%m-%d.org" org-journal-date-prefix "* " org-journal-enable-agenda-integration t org-journal-enable-cache t org-journal-time-format "")

Notes I know the org-journal-file-format needs the Year + Week + Month + Day. Does The org-journal-date-format need the same?

I also have another working journal that works with a "monthly" journal. This issue only occurs with my weekly journal.

bastibe commented 3 years ago

Thank you for the bug report. Does this bug happen with the default org-journal-file-format as well?

DominikMendel commented 3 years ago

When I used the journal in monthly I use: org-journal-file-format "Journal %Y-%m.org" Which works fine. Just an issue with the "weekly" + the file format you see above.

bastibe commented 3 years ago

Interesting. Thank you for the analysis.

I currently do not have the time to look into this any further. But pull requests are definitely welcome, and I'll try to help you as best I can if you choose to investigate this.

zzak commented 3 years ago

@bastibe If we modify org-journal-file-format do we also have to org-agenda like mentioned here?

Here's my config fwiw:

(setq org-journal-dir "~/org/log/")
(setq org-journal-date-format "%Y-%m-%d")
(setq org-journal-file-type 'weekly)
(setq org-journal-file-format "%Y-%m-%d.orgj")

The reason I'm using orgj for an extension is that I found org-journal-mode wasn't being activated without this:

(add-to-list 'auto-mode-alist '("\\.orgj\\'" . org-journal-mode))

Therefore my settings weren't being picked up.

I also had to set this to support .dir-locals.el so I could have multiple journals in separate directories.

(put 'org-journal-dir 'safe-local-variable #'stringp)

Such as:

; ~/logs/work/.dir-locals.el
((nil . ((org-journal-dir . "~/logs/work"))))

The reason I ask is that searching by tag, for example actually works somewhat, but I'm unable to actually open the entry and view it which is unfortunate.

bastibe commented 3 years ago

Thank you for the further investigation. Does it work if you use an absolute directory as org-journal-dir (i.e. without the ~)?

This is probably caused by something inside https://github.com/bastibe/org-journal/blob/master/org-journal.el#L460, where org-journal-is-journal does not believe your journal files to be journal files for some reason.

DominikMendel commented 3 years ago

Thank you for the further investigation. Does it work if you use an absolute directory as org-journal-dir (i.e. without the ~)?

That did not fix it.

zzak commented 3 years ago

Hello @bastibe,

Thanks for your reply.

I've also tried using the full absolute path and while searching does show some results (C-c C-s) when clicking on one of the entries in org-journal-search window I get the following message:

No journal entry for this date.

Any ideas?

bastibe commented 3 years ago

Nothing immediate comes to mind, I'm afraid. Are you by chance using a "strange" locale that might format dates in potentially problematic ways?

najibninaba commented 2 years ago

This is what happened to me as well when I moved to monthly org-journal files. The org-journal-search-forever function wouldn't work.

It turns out that each journal file needs to have the CREATED property set. However, once I added that manually to my monthly files, the org-journal-search-forever worked again. This is documented in the README already. I hope this helps!

DominikMendel commented 2 years ago

This is what happened to me as well when I moved to monthly org-journal files. The org-journal-search-forever function wouldn't work.

It turns out that each journal file needs to have the CREATED property set. However, once I added that manually to my monthly files, the org-journal-search-forever worked again. This is documented in the README already. I hope this helps!

This is not the case for me. All of my entries have a CREATED property.

Nothing immediate comes to mind, I'm afraid. Are you by chance using a "strange" locale that might format dates in potentially problematic ways?

I am not.