Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore unrecognized timestamps and timestamps in subheadings #397

Closed
xeruf opened this issue Sep 3, 2022 · 7 comments · Fixed by #407
Closed

Ignore unrecognized timestamps and timestamps in subheadings #397

xeruf opened this issue Sep 3, 2022 · 7 comments · Fixed by #407

Comments

@xeruf
Copy link
Collaborator

xeruf commented Sep 3, 2022

Description

I work with Orgzly, and this produces timestamps like:

:PROPERTIES:
:CREATED: [2022-08-23 Tue 10:09]
:END:

While org-journal for me uses:

org-journal-created-property-timestamp-format

Value
"[%Y-%m-%d]"

Expected Results

org-journal ignores:

  1. CREATED entries on subheadings
  2. CREATED entries outside of PROPERTIES drawers (yes I moved it out to test and org-journal did not care)
  3. CREATED entries that do not match its format

No errors, no complaining, just ignore them as if they weren't there :)

Actual Results

user-error: Created property timestamp format "[%Y-%m-%d]" doesn’t match CREATED property value (nil) from entry at line: Line 637
@xeruf
Copy link
Collaborator Author

xeruf commented Sep 3, 2022

Now this is really weird, if I call either of org-time-stamp(-inactive) anywhere as soon as org-journal is loaded, I get an error:

user-error: Created property timestamp format "[%Y-%m-%d]" doesn’t match CREATED property value ([2022-08-23 Tue 10:09]) from entry at line: Line 602

Seems like org-journal is hooked in somewhere it shouldn't be?

@xeruf
Copy link
Collaborator Author

xeruf commented Sep 3, 2022

See also #383 and #391

@xeruf
Copy link
Collaborator Author

xeruf commented Sep 20, 2022

okay, org-journal hooks into the calendar to mark days. I see @jmay @dppdppd you have already created patches, could you assist on this issue as well?

After an hour of debugging I think I found the culprit:

(defun org-journal--file->calendar-dates (file)
  "Return journal dates from FILE."
  (org-journal--with-journal
      file
    (let (dates)
      (save-excursion
        (goto-char (point-min))
        (while (re-search-forward org-journal--created-re nil t)
          (when (= (save-excursion (org-back-to-heading) (org-outline-level)) 1)
            (push (org-journal--entry-date->calendar-date) dates)))
        dates))))

my journal contains #+startup: overview, which means the headings are all folded and org-outline-level always reports 1.
Inserting outline-show-all in there did not seem to cut it :/

@jmay
Copy link
Collaborator

jmay commented Sep 20, 2022

@xeruf Make sure you restart your emacs and have the latest org-journal changes. Are you still getting errors? I can run org-time-stamp or org-time-stamp-inactive without problems. The calendar-dates function above was definitely where the patch was applied.

@xeruf
Copy link
Collaborator Author

xeruf commented Sep 22, 2022

yes, this works with the patch, which I've merged together at https://github.com/toemacs/org-journal

however, org-journal still erroneously checks on timestamps in subheadings.

@xeruf
Copy link
Collaborator Author

xeruf commented Oct 9, 2022

I am now getting user-error: Created property timestamp format "[%Y-%m-%d]" doesn’t match CREATED property value (nil) from entry at line: Line 7 and org-journal refuses to create timestamped headings.
I can't even find the line the error is about.

Can we somehow prevent all these kinds of errors from impeding basic org-journal functionality?

@xeruf
Copy link
Collaborator Author

xeruf commented Jan 6, 2023

Can we somehow prevent all these kinds of errors from impeding basic org-journal functionality?

Fixed by #380

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants