bastibe / org-journal

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

date is inserted every single time org-journal-new-entry is run #348

Open themaster567 opened 3 years ago

themaster567 commented 3 years ago

Describe the bug Creating a new entry always redundantly inserts the date headline, rather than just the first entry, meaning every single entry has both the time and the date above it.

To Reproduce Make an entry using org-journal-new-entry.

Expected behavior The date should only appear once at the top.

Screenshots Hid the actual entries for obvious reasons. image

Desktop (please complete the following information):

Your Emacs Configuration The part relevant to org-journal.

        org-journal-dir "~/Org/journal/"
        org-journal-date-format "%B %d, %Y (%A) "
        org-journal-file-format "%Y-%m-%d.org"
bastibe commented 3 years ago

Thank you for your bug report. I assume this is somehow related to your org-journal-date-format. Would you mind investigating which part of the date format is tripping up org-journal?

themaster567 commented 3 years ago

I've determined that it doesn't seem to be related. I tried out various date combinations and it didn't seem to fix it. To be thorough, I outright commented out the variable, reverting to the default format, and the bug persisted.

bastibe commented 3 years ago

What version of org-journal are you using?

themaster567 commented 3 years ago

I am using 20210326.1207, from the melpa. I should let you know that I'm using Doom Emacs, which does pin some packages at certain versions, but the creator told me to come to you after I unpinned the package so that it could be at the latest version without the issue being resolved.

On Thu, May 13, 2021 at 5:48 AM Bastian Bechtold @.***> wrote:

What version of org-journal are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bastibe/org-journal/issues/348#issuecomment-840448426, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB64GZ2XOEVYHDGB6LTBU23TNOOAJANCNFSM44Y7XHWA .

xeruf commented 3 years ago

I am using Doom Emacs with weekly journals and do not see anything like this. Is the date-property set under the headlines? This isn't apparent in the screenshot.

themaster567 commented 3 years ago

Is the date-property set under the headlines? This isn't apparent in the screenshot.

I have not set any other variables besides the ones I shared.

xeruf commented 3 years ago

By default, org-journal sets the created property for each headline:

* Friday, 2021-06-11
:PROPERTIES:
:CREATED:  [2021-06-11]
:END:

If that isn't set, that is probably the issue.

themaster567 commented 3 years ago

By default, org-journal sets the created property for each headline:

* Friday, 2021-06-11
:PROPERTIES:
:CREATED:  [2021-06-11]
:END:

If that isn't set, that is probably the issue.

Is this set every time in the day's org file, or somewhere in Emacs settings? Because that property has never appeared in my daily file.

xeruf commented 3 years ago

In the journal org file. Then apparently that is the issue. It has to be related to org-journal-date-format afaik...

themaster567 commented 3 years ago

In the journal org file. Then apparently that is the issue.

Then I guess I'll need to manually add that line for the day every time. That's unfortunate.

xeruf commented 3 years ago

No, you should work with @bastibe on finding a fix :)

bastibe commented 3 years ago

If I remember correctly, the CREATED property is only set on weekly, monthly, and yearly files. It is not necessary for daily files as the information is already encoded in the file name.

DerGuteMoritz commented 2 years ago

I had the same problem with version 2.1.2 with the following settings:

(setq org-journal-dir "~/org/journal/")
(setq org-journal-find-file 'find-file)
(setq org-journal-file-format "%Y%m.org")
(setq org-journal-file-type 'monthly)

I was able to fix it by downgrading my org version from 20210929 (obtained via the deprecated Org ELPA archive) to 9.5.2 (obtained from the GNU ELPA archive which is the new recommended way).

vitreousoul commented 2 years ago

I am using melpa version 20220103.829 with settings that include:

org-journal-date-format "%A, %x"
org-journal-file-format "%Y%m%d"
org-journal-file-type 'daily

I add entries during the day and usually the date header is only added once for the first entry. On occasion, in the middle of the day, org-journal begins adding a new date header when calling org-journal-new-entry.

I found that if I take the newly added date header, and replace the original, then org-journals stops adding new date headers.

So usually I have date headers like: * Friday, 03/18/2022 and when the bug occurs, I replace the header with the newly added date that's in the form: * Friday, 03/18/22

bastibe commented 2 years ago

It seems that some of your locale setting change at some point. When that happens, org-journal can't parse the previous date entry any longer and creates a new one.

DerGuteMoritz commented 9 months ago

It happened to me again now with org 9.6.8 and org-journal 2.2.0. However, I appear to have added the following org-journal-date-format in the meantime since my last comment above:

(setq org-journal-date-format "%Y-%m-%d (%A)")

From the discussion above I suspect that %A is the culprit somehow. Oddly, I was able to fix it (temporarily?) by completely restarting emacs just now...

mbriggs commented 6 months ago

I hit this as well, after debugging I realized I had an empty fundamental mode buffer named the same as the journal org file. After killing it, adding a new entry works as expected.

I'll try to catch it if it happens again about the situation where I end up with the buffer, I was doing so much stuff in between the first occurrence and figuring that out that I have no clue.