wakatime-mode
wakatime-mode copied to clipboard
Add Project Information Using Projectile
Have you through about adding project information using the Emacs Projectile package?
I noticed when using the Emacs plugin my projects were all set to "Other". Some further digging showed that the --project
option was not specified.
Currently, I have redefined the wakatime-client-command
function in my Emacs configuration file. I believe this is a working proof of concept. What is needed is adding logic to keep the current logic if Projectile is not found. I did not do this as I know I have projectile installed.
My current logic is to get the projectile-project-name, if it is -
then there is no project otherwise there is a project with the name given. There might be a need for more validation, for example it is possible to have two projects on the file system both of which have the same name (but different directories). Also, I am unsure if projectile-project-name is -
for all projects on all versions of projectile. I discovered the -
return using eshell in different directories.
I hope this helps improve the plugin.
(defun wakatime-client-command (savep)
"Return client command executable and arguments.
Set SAVEP to non-nil for write action."
(format "%s%s--file \"%s\" --plugin \"%s/%s\" --project \"%s\" --time %.2f%s%s"
(if (s-blank wakatime-python-bin) "" (format "\"%s\" " wakatime-python-bin))
(if (s-blank wakatime-cli-path) "wakatime " (format "\"%s\" " wakatime-cli-path))
(buffer-file-name (current-buffer))
wakatime-user-agent
wakatime-version
(let ((pname (projectile-project-name)))
(if (string= pname "-")
"Other"
pname))
(float-time)
(if savep " --write" "")
(if (s-blank wakatime-api-key) "" (format " --key %s" wakatime-api-key))))