bastibe / org-journal

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

journal entries are not carried over when there are file headers #416

Open pcompassion opened 10 months ago

pcompassion commented 10 months ago

Describe the bug A clear and concise description of what the bug is. expect TODO items to be carried over when creating new entry (new date)

If I remove the file headers from the previous date , then carry over works,

The following is the contents on top of the journal file


#+STARTUP: showall showstars indent
#+PROPERTY: notify journal
#+FILETAGS: journal

i tried to debug a bit, doom emacs pinned version had `

  (when (and (< 1 (length (split-string file-header "\n" :omit-nulls t)))

`

current version has (when (and (< 1 (length (split-string file-header "\n" :omit-nulls)))

after fixing this, still having issues..

To Reproduce Steps to reproduce the behavior: execute org-journal-new-entry

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Your Emacs Configuration The part relevant to org-journal.

g6ai commented 10 months ago

Do you use Doom Emacs? I use Doom Emacs and have encountered this issue after a recent Doom Emacs major update

pcompassion commented 10 months ago

yes, I also did doom update recently.

I tried to debug,

org journal seems to assume a heading (with *) is the first item in a file, and #+ fileheader seems to break that assumption previous org version might have been grateful on error handling,

that's my guess

for instance


(defun org-journal--finalize-view ()
  "Finalize visability of entry."
  (org-journal--decrypt)

  (if (org-journal--is-date-prefix-org-heading-p)

      (progn
        (org-next-visible-heading 1)
        (when (org-at-heading-p)
          (org-up-heading-safe))
    (unless (org-at-heading-p)
          (org-next-visible-heading 1)
      )
        (org-back-to-heading)
        (outline-hide-other)
        (outline-show-subtree)
        )
    (outline-show-all)))

I added org-next-visible-heading

org-up-heading-safe goes to file header, and it errors out in org-back-to-heading

The above code fixes that case, but I think there are other instances of this sort elsewhere in the library