Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

heartbeats are ignored for files loaded over tramp #27

Open
amoore opened this issue Nov 29, 2016 · 7 comments
Open

heartbeats are ignored for files loaded over tramp #27

amoore opened this issue Nov 29, 2016 · 7 comments

Comments

@amoore
Copy link

amoore commented Nov 29, 2016

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.

@alanhamlett
Copy link
Member

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?

@hofstee
Copy link

hofstee commented Apr 10, 2018

Bumping this just to show there's still interest in this.

@alanhamlett
Copy link
Member

How about this solution:

  1. When wakatime-mode detects a file doesn't exist, instead of noop it checks if that file is a remote tramp file.
  2. If it's a remote tramp file, it gets the file's contents from the local tramp buffer or cache. (this?)
  3. 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.

@alanhamlett
Copy link
Member

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

@jashank
Copy link

jashank commented Jul 7, 2018

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.

@alanhamlett
Copy link
Member

Related to wakatime/wakatime-cli#623, which added support for ssh:// and sftp:// remote files.

@benwoosley
Copy link

Still having this issue using tramp on doom emacs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants