kidd/org-gcal.el

org-gcal-fetch wipes out CLOSED date

wrn opened this issue · 4 comments

wrn commented

To reproduce:

  1. Create a TODO entry, and schedule it with "org-schedule"
  2. org-gcal-post-at-point post the entry to Google calendar
  3. Close the entry in org file with "org-todo", adding "CLOSED [date]" automatically
  4. run org-gcal-fetch, "CLOSED [date]" is wiped out in org buffer.
wrn commented

I tried this patch on function "org-gcal--update-entry" and it seems to have fixed the issue. If somebody can confirm this is indeed the right fix, that will be great. Thanks.

modified   org-gcal/org-gcal.el
@@ -1714,7 +1714,7 @@ heading."
                        (if (< 11 (length end))
                            end
                          (org-gcal--iso-previous-day end))))))))
-      (if (org-element-property :scheduled elem)
+      (if (and (org-element-property :scheduled elem) (not (org-entry-is-done-p)))
           (unless (and recurrence old-start) (org-schedule nil timestamp))
         (insert timestamp)
         (newline)

@wrn That fix is on the right track, but I'm going to merge a better fix. What you're seeing is due to the behavior of org-schedule. See #219

wrn commented

It is indeed a better fix. Thanks!

wrn commented

Thanks for the merging the fix. But it seems the fix does not work as expected. Please see my comments to the commit. Thanks.