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

Refactoring, bugfixes, and unit test for sync-todos #2

Open
wants to merge 22 commits into
base: sync-todos
Choose a base branch
from

Conversation

jackkamm
Copy link

@jackkamm jackkamm commented Aug 28, 2022

This PR refactors the sync-todos branch to bring it closer to upstream, while preserving all new functionality. It also includes several bugfixes, and a unit test for the sync-todo functionality.

Unlike my previous "barebones" branch that I posted in dengste#218, this PR preserves all the functionality in the sync-todos branch (e.g. days-in-past, percent-complete handling). However, it still achieves a substantial reduction in divergence from upstream, by removing whitespace changes, reducing code duplication, and other refactoring:

# Original sync-todos branch
git diff --stat master org-caldav.el
 org-caldav.el | 1844 ++++++++++++++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 1190 insertions(+), 654 deletions(-)

# sync-todos-refactored branch (this PR)
git diff --stat master org-caldav.el
 org-caldav.el | 810 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
 1 file changed, 637 insertions(+), 173 deletions(-)

The PR also merges in my branch which fixes the unit tests and related bugs: dengste#252
Additionally, I added a new unit test for the sync-todos functionality. Also, this PR includes some fixes for bugs I found after I merged the updated the unit tests.

Finally, sync-todo now respects when org-caldav-sync-changes-to-org is "all", which is a consequence of more consistent handling of updates to events and todos.

This reverts commit 2d48c55.

That commit was buggy and for example breaks unit test
org-caldav-01-sync-test, due to the bad line with
org-planning-line-re.

This reverts the commit, and instead leaves a comment to deal with the
deprecated variable later. It is not urgent as
org-maybe-keyword-time-regexp is still defined in org-compat.el.
This commit makes org-caldav more robust to recent changes in
org-id.el, both in the official Org-mode releases as well as on the
Org-mode development branch.

Fixes dengste#230. Fixes some of the unit tests (dengste#251).

See also:
https://list.orgmode.org/87r11un9in.fsf@localhost/T/#t
Reduced code duplication. Made VTODO respect
org-caldav-sync-changes-to-org, including when it's "all", so VTODO
descriptions can also be updated now.
org-caldav-set-sequence-number tries to delete the existing SEQUENCE,
but if it doesn't exist, it will just delete another random line,
causing unit test 01 to fail.
In org-caldav-generate-ics, org-export-before-parsing-hook didn't get
org-caldav-skip-function properly added to it, because it was bound
twice in a let (instead of let*).

In org-caldav-skip-function, it was erroring when
org-caldav-days-in-past is nil, because of trying to compare a nil
value.
I found that fix-todo-priority may sometimes match the PRIORITY from
the wrong entry. To prevent this, narrow to the current subtree before
searching.
jackkamm and others added 11 commits August 28, 2022 14:07
This behavior was accidentally removed during the refactor
This prevents org-id-find from returning the wrong entry in future
syncs.

Previously, I had mitigated this problem by not visiting the backup
file when syncing, however that solution didn't protect against the
case where the user manually visits the backup file.
Fix timestamp & ID bugs to make the unit tests work again
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 this pull request may close these issues.

1 participant