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

Add Project Information Using Projectile #52

Open
acminor opened this issue Jan 22, 2021 · 0 comments
Open

Add Project Information Using Projectile #52

acminor opened this issue Jan 22, 2021 · 0 comments

Comments

@acminor
Copy link

acminor commented Jan 22, 2021

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))))
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

1 participant