wakatime-mode
wakatime-mode copied to clipboard
heartbeats are ignored for files loaded over tramp
Wakatime does not appear to keep track of time spent in files loaded from remote machines via tramp.
For example, if I visit a file like "/ssh:remotehostname:/home/user/example.conf", then this appears in the log:
{"now": "2016/11/29 10:31:35 -0500", "version": "6.2.0", "plugin": "emacs-wakatime/1.0.2", "caller": "main.py", "lineno": 541, "file": "/ssh:remotehostname:/home/user/example.conf", "level": "DEBUG", "message": "File does not exist; ignoring this heartbeat."}
That file does exist, but I don't think that wakatime realizes that it's on a remote machine.
Perhaps it should be testing for file existence at all.
Don't want to read a remote file every time a heartbeat is sent, for performance reasons. Could we pass wakatime-cli a local temporary file along with the "real path" of that file?
Bumping this just to show there's still interest in this.
How about this solution:
- When wakatime-mode detects a file doesn't exist, instead of noop it checks if that file is a remote tramp file.
- If it's a remote tramp file, it gets the file's contents from the local tramp buffer or cache. (this?)
- wakatime-mode sends the buffer/tmp file to wakatime-cli along with
--real-entity <actual file path>
so wakatime-cli reads the file's stats from the local file but uses<actual file path>
for the name displayed on your dashboard.
The change to wakatime-cli is trivial, I just don't know where tramp stores it's local copy of a remote file.
Looks like tramp uses generate-new-buffer-name
to create a local buffer when editing files. If we can pass that local buffer file to wakatime-cli then we can track tramp files:
https://github.com/jwiegley/tramp/blob/master/lisp/tramp.el#L628
I've just tested that on a few mechanisms, and tramp-temp-buffer-file-name
doesn't seem to ever get a value, so I think that might be a bust.
Related to wakatime/wakatime-cli#623, which added support for ssh://
and sftp://
remote files.
Still having this issue using tramp on doom emacs