diff mbox series

[bug#59552] gnu: Add emacs-wakatime-mode.

Message ID 20221125011530.12585-1-hako@ultrarare.space
State New
Headers show
Series [bug#59552] gnu: Add emacs-wakatime-mode. | expand

Commit Message

Hilton Chain Nov. 25, 2022, 1:15 a.m. UTC
* gnu/packages/emacs-xyz.scm (emacs-wakatime-mode): New variable.
---
 gnu/packages/emacs-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)


base-commit: 5eb2995c006283fc0b649f10a6d002580ccac8d6
--
2.38.1

Comments

Nicolas Goaziou Nov. 26, 2022, 10:21 a.m. UTC | #1
Hello,

Hilton Chain via Guix-patches via <guix-patches@gnu.org> writes:

> * gnu/packages/emacs-xyz.scm (emacs-wakatime-mode): New variable.

Thank you.

> +(define-public emacs-wakatime-mode
> +  ;; No release since May 5, 2015.
> +  (let ((version "1.0.2") ;32a0154cd4bbd525d354997e6b12c6a9726d0b43, not tagged
> +        (revision "55")
> +        (commit "ef923829912c3854d230834f81083814b7c9d992"))

You can insert "1.0.2" directly in `version' field below instead of
binding it beforehand.

> +    (package
> +      (name "emacs-wakatime-mode")
> +      (version (git-version version revision commit))
> +      (source (origin
> +                (method git-fetch)
> +                (uri (git-reference
> +                      (url "https://github.com/wakatime/wakatime-mode")
> +                      (commit commit)))
> +                (file-name (git-file-name name version))
> +                (sha256
> +                 (base32
> +                  "0m29817s2din4n42pflvzg2538i91s0n06y78pf8q94qf0mfspcl"))))
> +      (build-system emacs-build-system)
> +      (arguments
> +       (list #:phases
> +             #~(modify-phases %standard-phases
> +                 ;; XXX: WakaTime hasn't packaged in Guix yet.
> +                 (delete 'patch-el-files))))

Wouldn't it make sense to package WakaTime first, then?

Could you also run tests?

> +      (home-page "https://wakatime.com/emacs")
> +      (synopsis "Automatic time tracking extension for Emacs using WakaTime")
> +      (description
> +       "@code{wakatime-mode} is an Emacs plugin for automatic time tracking
> +and metrics generated from your programming activity.")

WakaTime mode is an Emacs minor mode for automatic...

Regards,
Liliana Marie Prikler July 16, 2023, 7:17 a.m. UTC | #2
Am Samstag, dem 15.07.2023 um 23:01 +0800 schrieb Hilton Chain:
> --8<---------------cut here---------------start------------->8---
> (defun wakatime-find-binary (program)
>   "Find the full path to an executable program."
>   (cond
>     [...]
>     ((file-exists-p (format "/bin/%s" program))
>       (format "/bin/%s" program))
>     [...]))
> --8<---------------cut here---------------end--------------->8---
> 
> This seems to be a bug of the phase, as it shouldn't handle
> unformatted
> "/bin/%s" at all.  And for the function finding an executable, it's
> unnecessary to patch it, then I think it's fine to delete the phase.
I think this should be 
  (or (executable-find program) 
      (cdr-safe (assoc program <some hardcoded table>))
where some hardcoded table contains stubs to fill in via 
(search-input-file …)

Cheers
Hilton Chain July 18, 2023, 4:35 p.m. UTC | #3
On Sun, 16 Jul 2023 15:17:01 +0800,
Liliana Marie Prikler wrote:
> I think this should be 
>   (or (executable-find program) 
>       (cdr-safe (assoc program <some hardcoded table>))
> where some hardcoded table contains stubs to fill in via 
> (search-input-file …)

Thank you for the suggestion!

Sorry for the incomplete information, the PROGRAM argument is actually
nonsense because `wakatime-find-binary' is not a user-facing function
and is called with a fixed value of "wakatime-cli", so it's not
appropriate to use an alist.  

Other (hardcoded) values are actually handled as conditions within the
function. 

I tried replacing the conditions with yours, except for the `cdr-safe'
line, which is replaced by a `locate-file', and it seems to work fine.
The new function does not contain a "/bin/[...]" so 'patch-el-files
won't handle it.

This may not be expected but I think it's enough to improve the
function itself.

I'll send a patch to upstream and send v3 later.

Thanks
diff mbox series

Patch

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index e941064d07..a6002efa51 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -34160,6 +34160,36 @@  (define-public emacs-semi-epg
 EasyPG and latest Emacs.")
       (license license:gpl2+))))

+(define-public emacs-wakatime-mode
+  ;; No release since May 5, 2015.
+  (let ((version "1.0.2") ;32a0154cd4bbd525d354997e6b12c6a9726d0b43, not tagged
+        (revision "55")
+        (commit "ef923829912c3854d230834f81083814b7c9d992"))
+    (package
+      (name "emacs-wakatime-mode")
+      (version (git-version version revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/wakatime/wakatime-mode")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0m29817s2din4n42pflvzg2538i91s0n06y78pf8q94qf0mfspcl"))))
+      (build-system emacs-build-system)
+      (arguments
+       (list #:phases
+             #~(modify-phases %standard-phases
+                 ;; XXX: WakaTime hasn't packaged in Guix yet.
+                 (delete 'patch-el-files))))
+      (home-page "https://wakatime.com/emacs")
+      (synopsis "Automatic time tracking extension for Emacs using WakaTime")
+      (description
+       "@code{wakatime-mode} is an Emacs plugin for automatic time tracking
+and metrics generated from your programming activity.")
+      (license license:gpl3+))))
+
 (define-public emacs-wanderlust
   ;; No release since Jan 15, 2010.
   ;; FIXME: Building with emacs-next-pgtk would yield a void variable related