bastibe / org-journal

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

Encrypted journals do not carry over well #352

Open arifer612 opened 3 years ago

arifer612 commented 3 years ago

Describe the bug Creating a new encrypted journal entry, whether it be the first entry of the day or not, always prompts me if I would like to kill the previous day's entry because it has been modified.

To Reproduce Steps to reproduce the behavior:

Expected behavior The buffer for the previous day's journal should be saved and killed without a prompt.

Screenshots Prompt to kill previous day's buffer The whole message log

Desktop (please complete the following information):

Your Emacs Configuration The part relevant to org-journal.

(setq org-journal-enable-encryption t
      org-journal-encrypt-journal t
       )

Leads I have deduced that this is from org-journal-carryover-items. It is in this function that the kill-buffer function is called to kill the previous journals after checking for items with the carryover value. When not encrypted, this works fine just as it is. There is no prompt to kill the previous day's journal entry and any carryover items if present will be carried over without an issue.

I believe that the reason for the discrepancy is that the carryover is done when the previous journals are de-encrypted and need to be re-encrypted and saved again before saving (the org-journal-encrypt-on variable does not seem to trigger the encryption process at all here for some reason). This is may be a small issue but it keeps popping up every time I start a new Emacs session (when I accidentally close my daemon) and want to add in a new journal entry.

bastibe commented 3 years ago

Thank you for your bug report and analysis. Would you like to investigate this issue yourself? Pull requests are certainly welcome!

arifer612 commented 3 years ago

Sure thing, I'll look more into it once I have the time. I needed to put it out here for documentation and in case there are others out there who were facing the same issue.

By the way, this package is a wonderful tool for my workflow, I love it! Thank you for making this!