org-journal icon indicating copy to clipboard operation
org-journal copied to clipboard

Weekly journal search feature doesn't work

Open DominikMendel opened this issue 3 years ago • 10 comments

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

  • OS: [e.g. iOS] Arch Linux
  • Emacs Version 27.2. (Doom)

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.

DominikMendel avatar Jul 04 '21 21:07 DominikMendel

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

bastibe avatar Jul 07 '21 10:07 bastibe

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.

DominikMendel avatar Jul 08 '21 02:07 DominikMendel

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.

bastibe avatar Jul 14 '21 09:07 bastibe

@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.

zzak avatar Jul 19 '21 12:07 zzak

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.

bastibe avatar Jul 20 '21 19:07 bastibe

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.

DominikMendel avatar Jul 28 '21 23:07 DominikMendel

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?

zzak avatar Aug 21 '21 01:08 zzak

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

bastibe avatar Aug 22 '21 12:08 bastibe

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!

najibninaba avatar Sep 09 '21 12:09 najibninaba

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.

DominikMendel avatar Sep 09 '21 13:09 DominikMendel