kidd / org-gcal.el

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

org-gcal-delete-at-point removed original event information in org file #169

Open wrn opened 2 years ago

wrn commented 2 years ago

After I invoke org-gcal-delete-at-point , the headline state is marked as "CANCELED" just as I configured and expected (good!), but the original scheduling information in ":org-gcal:" drawer is removed (actually, the whole drawer is gone). I think most likely the reason people want to keep the headline (and marked it as "CANCELED") after it is deleted from the Google calendar is because they still want to preserve the event information. So can we change this behavior and keep the :org-gcal: drawer? Thanks.

telotortium commented 2 years ago

That is a good idea. If you have the ability to open a pull request, that would be great. There's probably some code that assumes that the presence of the drawer indicates an event managed by org-gcal, so you would have to find that code and change it to use something else, like a property.

On Tue, Oct 19, 2021, 13:29 wrn @.***> wrote:

After I invoke org-gcal-delete-at-point , the headline state is marked as "CANCELED" just as I configured and expected (good!), but the original scheduling information in ":org-gcal:" drawer is removed (actually, the whole drawer is gone). I think most likely the reason people want to keep the headline (and marked it as "CANCELED") after it is deleted from the Google calendar is because they still want to preserve the event information. So can we change this behavior and keep the :org-gcal: drawer? Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/kidd/org-gcal.el/issues/169, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANMVDMNVYD3JBFDDBVCLODUHXILHANCNFSM5GKAUO4A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

wrn commented 2 years ago

Thanks for endorsing the idea. I am not sure my elisp skill is up to the task, but I may give it a try later. Just do not count on it. :-)

wrn commented 1 year ago

I came back to this again. What I did in my own local version of org-gcal is when deleting an event, change the "org-gcal" drawer name to "org-gcal-relic". I dare not just keep it as it is because the code comments says this drawer was deleted so it won't confuse other part of the code, so I choose to just to use another drawer name.

A snippet of my code in function "org-gcal-delete-at-point"

                ;; Delete :org-gcal: drawer after deleting event. This will preserve
                ;; the ID for links, but will ensure functions in this module don’t
                ;; identify the entry as a Calendar event.
                (org-with-point-at marker
                  (when (re-search-forward
                         (format
                          "^[ \t]*:\\(%s\\):[^z-a]*?\n[ \t]*:END:[ \t]*\n?" ;; Changed !!!
                          (regexp-quote org-gcal-drawer-name))
                         (save-excursion (outline-next-heading) (point))
                         'noerror)                   
                    (replace-match (format "%s-relic" org-gcal-drawer-name) 'fixedcase t nil 1))  ;; !!! Changed