kidd / org-gcal.el

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

org-gcal-fetch wipes out CLOSED date #218

Closed wrn closed 1 year ago

wrn commented 1 year ago

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 1 year ago

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)
telotortium commented 1 year ago

@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 1 year ago

It is indeed a better fix. Thanks!

wrn commented 1 year ago

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