kidd / org-gcal.el

Org sync with Google Calendar. (active maintained project as of 2019-11-06)
435 stars 47 forks source link

Fix #172, point to beginning for parsing headline #179

Closed rhaps0dy closed 2 years ago

rhaps0dy commented 2 years ago

To parse an org headline, the point needs to be at the beginning of it. After that, we move to the timestamp to parse it too.

Fixes #172

telotortium commented 2 years ago

Thanks for the fix! Do you have an example of a headline that this fixes? I'd like to add a regression test if possible.

rhaps0dy commented 2 years ago

In my setup, all headlines are broken without this fix. I'll come up with a test for org-gcal--archive-old-event, for which there is none at the moment.

An example is

* Headline that is broken
:PROPERTIES:
things...
:END:
<2022-01-17 12:34-13:45>
telotortium commented 2 years ago

Thanks, I will look at this in a few hours

rhaps0dy commented 2 years ago

Finally added the test! I've used some macros from org-test, which is used to test Org mode code. The code to find it is on the (require) form at the top of the test file. I've tried to make finding org-test.el work for other people, but I can't be fully sure.

I've also fixed another "bug", which only came up if your org-archive-location is in the same file: the same entries would be "archived" over and over because they would be found by the loop many times. Also entries that are not calendar items were archived as well. That is now fixed and the test tests for it.

John-Goff commented 2 years ago

I tested this branch, can confirm it fixes #172 for my setup. Thanks!

maikol-solis commented 2 years ago

Another happy user here. All my old events are archived properly with this PR.

Thanks!

telotortium commented 2 years ago

Thanks - I'd love to merge this, but the code to find org-test doesn't seem to work on the Github Actions CI for some reason:

Cannot open load file: No such file or directory, /nix/store/114zrlnbkbqfvlsm0sialj7fyva305sv-emacs-27.1/share/emacs/27.1/lisp/testing/org-test.el
telotortium commented 2 years ago

It's because we're trying to load the built-in Emacs org rather than downloading it from Melpa. Need to figure out how to download it.

telotortium commented 2 years ago

I've debugged following the instructions in https://github.com/marketplace/actions/debugging-with-ssh, and it seems like we're using the built-in Org. We need to download Org from the Org package repository.

telotortium commented 2 years ago

I'm still having trouble figuring out how to retrieve the testing files from upstream. It may be best just to manually add org-test.el to the repo, since the testing directory isn't included by default in Org as installed via ELPA (or builtin to Emacs).

telotortium commented 2 years ago

@rhaps0dy I've been adding some additional fixes to the tests in #192. I've finally gotten it to the point where everything works except for org-gcal-test--headline-archive-old-event: https://github.com/kidd/org-gcal.el/runs/5656094259?check_suite_focus=true

telotortium commented 2 years ago

I'm going to close this in favor of #192.