bastibe / org-journal

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

journal files are decrypted whenever the calendar is invoked. #375

Open dppdppd opened 2 years ago

dppdppd commented 2 years ago

Every time I bring up the calendar to update a deadline or schedule in the agenda, org-journal decrypts all of my journal files.

I have org-journal-enable-agenda-integration set to nil. I do not have journal files in my agenda-files. I have confirmed that disabling org-journal eliminates this behavior.

Is this a bug? A misconfiguration on my part?

my configuration:

(use-package! org-journal :defer t :custom (org-journal-dir (concat org-root "/journal/")) (org-journal-file-format "%Y-%m.org") (org-journal-file-type 'monthly) (org-journal-date-format "%Y-%m-%d") (org-journal-created-property-timestamp-format "[%Y-%m-%d %a]") (org-journal-encrypt-journal t) (org-journal-enable-agenda-integration nil))

bastibe commented 2 years ago

I think that's necessary in monthly mode. How else could the calendar find out about the dates of your journal entries? The calendar integration is currently not optional.

That said, decryption is not strictly necessary in daily mode, but I don't know if the code is aware of that.

dppdppd commented 2 years ago

It’s a pretty rough experience: each task (entirely unrelated to the journal) I want to update the time stamp on is a 10-20 second pause.

I find it hard to believe that anyone suffers through this so my setup must be unusual in one way or another.

bastibe commented 2 years ago

You are indeed not alone: enabling org-journal-enable-cache should speed up calendar operations considerably.

Sorry for not mentioning that earlier. Since I don't use monthly/weekly files, nor encryption, I didn't keep up with all the cool tech @cslux and others built for these code paths.

dppdppd commented 2 years ago

hmm. Well that certainly seems like the variable I want but it doesn't make a difference. All journal files are decrypted on every activation of the calendar.

When agenda integration is off and the calendar does not show journal entries, what is the purpose of parsing the journal contents?

dppdppd commented 2 years ago

OK. So I removed the calendar hooks. Org-journal now doesn't bother me at all outside of org-journal usage. I have yet to noticed any ill effects, although I also only use a small subset of org-journal features.

Might be interesting to condition the hooks on agenda integration or a new calendar integration variable.

(use-package! org-journal
  :after org
  :custom
  (org-journal-dir (concat org-root "/journal/"))
  (org-journal-file-format "%Y-%m.org")
  (org-journal-file-type 'monthly)
  (org-journal-date-format "%Y-%m-%d")
  (org-journal-enable-cache t)
  (org-journal-created-property-timestamp-format "[%Y-%m-%d %a %H:%M]")
  ;; (org-journal-created-property-timestamp-format "[%Y-%m-%d %a]")
  ;; (org-journal-time-format "[%Y-%m-%d %a %H:%M]")
  (org-journal-encrypt-journal t)
  (org-journal-enable-agenda-integration nil)
  :config
  (remove-hook 'calendar-today-visible-hook 'org-journal-mark-entries)
  (remove-hook 'calendar-today-invisible-hook 'org-journal-mark-entries))
bastibe commented 2 years ago

hmm. Well that certainly seems like the variable I want but it doesn't make a difference. All journal files are decrypted on every activation of the calendar.

That's regrettable. Did you run the experiment at least twice? I'd guess that the caching functionality is slow on the first invocation of the calendar, but fast on subsequent ones.

When agenda integration is off and the calendar does not show journal entries, what is the purpose of parsing the journal contents?

That sounds like a bug to me. Come to think of it, though, an additional variable org-journal-enable-calendar-integration might be a good idea. It would simply not set the two calendar hooks, and not set the keyboard shortcuts on the calendar map. Would you like to contribute that as a pull request?

At any rate, there shouldn't be any interaction between the agenda integration and the calendar integration. You should be able to activate one but not the other.

dppdppd commented 2 years ago

That's regrettable. Did you run the experiment at least twice? I'd guess that the caching functionality is slow on the first invocation of the calendar, but fast on subsequent ones.

I may have misunderstood but I expected it to not open journal files once the calendar was visibly marked, but it did. I didn’t spend more time on it once that expectation was violated.

That sounds like a bug to me. Come to think of it, though, an additional variable org-journal-enable-calendar-integration might be a good idea. It would simply not set the two calendar hooks, and not set the keyboard shortcuts on the calendar map. Would you like to contribute that as a pull request?

Happy to. Let me figure out how to do that.

bastibe commented 2 years ago

I may have misunderstood but I expected it to not open journal files once the calendar was visibly marked, but it did. I didn’t spend more time on it once that expectation was violated.

I see. That is clearly problematic and not what I would have expected, either.

casch-at commented 6 months ago

@dppdppd Sorry, I should have read carefully through the issue.