pauldub / activity-watch-mode

Emacs plugin for automatic time tracking and metrics generated from your programming activity.
https://activitywatch.net
70 stars 9 forks source link

`activity-watch-mode` conflicts with `recover-this-file` #23

Closed benthamite closed 7 months ago

benthamite commented 1 year ago

Thanks for creating this package. This is to let you know that if activity-watch is enabled, recover-this-file will fail with the message “process-file: Invalid coding system: auto-save-coding”. I have experienced this issue, and here another user reports experiencing it, too.

meliache commented 1 year ago

The Wakatime-Issue for this problem (which I got from the Stackoverflow like above) is https://github.com/wakatime/wakatime-mode/issues/10, so ideally this should be fixed upstream in Wakatime and then merged here.

pauldub commented 1 year ago

The wakatime issue has been open for a long time and there is a significant drift between the two projects so I think we can look for a fix ourselves and proposes changes upstream if it makes sense.

I don't have the bandwidth to look into this at the moment, but if I will happily review pull requests.

meliache commented 7 months ago

The wakatime issue linked above has been fixed in https://github.com/wakatime/wakatime-mode/commit/aa04a5551e782992ddaea890d8547863b0d6ba60. Explanation of the problem is in https://github.com/wakatime/wakatime-mode/issues/10#issuecomment-1905607164. I adapted the fix almost one to one in https://github.com/meliache/activity-watch-mode/commit/d5cc52dc825a39f375516eb3dabd512000b382ce, which should work if the error happens in activity-watch--call.

The only problem is that I haven't tested yet whether this fix works. Using my branch I didn't get any errors when running recover-this-file, but neither did I when I tested it with the original branch, weird :thinking: .

benthamite commented 7 months ago

Thanks, @meliache. I have now installed your branch and will let you know if I experience any issues.

meliache commented 7 months ago

@benthamite If it works for you I can open a PR. I just didn't do so because I don't really understand the explanation of the issue, i.e. where exactly the coding system is evaluated in wakatime/activity-watch, and thus I was not sure about the best place where to put the fix. I just blindly copied the fix from wakatime without fully understanding it, but it seems to work for me so far. Just waiting for somebody else to test it.

benthamite commented 7 months ago

Hi @meliache,

I haven’t noticed any issues since re-enabling the package. Just a minute ago, I deliberately force-closed a buffer so that I could later recover the file it was visiting, and running recover-this-file went smoothly. So it seems to be fixed.