bastibe / org-journal

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

'org-journal-new-entry' now seems broken with error: 'org-element-at-point' cannot be used in non-Org buffer #423

Closed pjdurai closed 7 months ago

pjdurai commented 8 months ago

Describe the bug When I invoke org-journal-new-entry, it causes the error. I have a weekly journal file rotation setup. It opens the right journal file and adds the date stamp correctly. But it fails when trying to add the timestamp.

To Reproduce Invoke 'org-journal-new-entry'

Desktop (please complete the following information):

Your Emacs Configuration (setq org-directory "~/gtd/") (setq org-gtd-directory "~/gtd/") (setq org-journal-dir "~/gtd/journal/") (setq org-journal-date-format "%A, %d %B %Y") (setq org-journal-file-type 'weekly)

Related: https://github.com/steelman/org-mode/issues/1 https://github.com/alphapapa/org-web-tools/issues/56

pjdurai commented 7 months ago

Looks like the error has been reduced to a warning in https://git.savannah.gnu.org/git/emacs/org-mode.git on commit fac55324accbcab08dfebbde8295b2f1b4b9f45e on2023/11/05.

wangwb98 commented 1 month ago

Hi @pjdurai , suggest to re-open this issue,In my similar setup as yours (weekly journal), when I try to add a inactive-date by using org-timestamp-inactive after emacs was launched, it fails in the first time. It can only work on the 2nd trial. So it's not only a harmless warning to the user.

org 9.7 has this warning and it's expecting to use org-element-at-point with in an org buffer (maybe due to org parser change in org 9.7).

But org-journal--file->calendar-dates calls org-journal--with-journal which opens the file in fundamental-mode on purpose, then it calls org-back-to-heading which uses org-element-at-point.

My understanding is, if we want to use org-back-to-heading of org 9.7, we should make sure current buffer is org-mode, not fundamental mode.

Who knows the history that why org-journal--with-journal was forcing it to fundamental-mode? That information may help us on how to make org-journal better working with org 9.7.

Thanks.