GNU bug report logs - #59552
[PATCH] gnu: Add emacs-wakatime-mode.

Previous Next

Package: guix-patches;

Reported by: Hilton Chain <hako <at> ultrarare.space>

Date: Fri, 25 Nov 2022 01:17:02 UTC

Severity: normal

Tags: moreinfo, patch

To reply to this bug, email your comments to 59552 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#59552; Package guix-patches. (Fri, 25 Nov 2022 01:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hilton Chain <hako <at> ultrarare.space>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 25 Nov 2022 01:17:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: guix-patches <at> gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH] gnu: Add emacs-wakatime-mode.
Date: Fri, 25 Nov 2022 09:15:30 +0800
* gnu/packages/emacs-xyz.scm (emacs-wakatime-mode): New variable.
---
 gnu/packages/emacs-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

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

base-commit: 5eb2995c006283fc0b649f10a6d002580ccac8d6
--
2.38.1




Information forwarded to guix-patches <at> gnu.org:
bug#59552; Package guix-patches. (Sat, 26 Nov 2022 10:23:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
To: Hilton Chain via Guix-patches via <guix-patches <at> gnu.org>
Cc: Hilton Chain <hako <at> ultrarare.space>, 59552 <at> debbugs.gnu.org
Subject: Re: [bug#59552] [PATCH] gnu: Add emacs-wakatime-mode.
Date: Sat, 26 Nov 2022 11:21:53 +0100
Hello,

Hilton Chain via Guix-patches via <guix-patches <at> 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,
-- 
Nicolas Goaziou




Information forwarded to guix-patches <at> gnu.org:
bug#59552; Package guix-patches. (Sat, 26 Nov 2022 10:23:02 GMT) Full text and rfc822 format available.

Added tag(s) moreinfo. Request was from Christopher Baines <mail <at> cbaines.net> to control <at> debbugs.gnu.org. (Mon, 28 Nov 2022 09:03:02 GMT) Full text and rfc822 format available.

Information forwarded to andrew <at> trop.in, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#59552; Package guix-patches. (Sat, 15 Jul 2023 15:05:01 GMT) Full text and rfc822 format available.

Message #16 received at 59552 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: 59552 <at> debbugs.gnu.org
Cc: Hilton Chain <hako <at> ultrarare.space>,
 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
Subject: [PATCH v2 0/1] gnu: Add emacs-wakatime-mode.
Date: Sat, 15 Jul 2023 23:01:40 +0800
Hello Guix!

After looking through waktime-mode's source and Guix's build phases, I think
it's OK to add the package first without packaging the wakatime-cli program.

(Actually I managed to package all the dependencies of that go program locally,
but it eventually failed to build without a clear error...)

For the package definition itself, phase 'patch-el-files is still deleted
because of the following error:

--8<---------------cut here---------------start------------->8---
In guix/build/emacs-build-system.scm:
   148:13  3 (loop (#("    ((file-exists-p (format \"/bin/%s\" …" …)) …)
In ice-9/boot-9.scm:
  1685:16  2 (raise-exception _ #:continuable? _)
  1685:16  1 (raise-exception _ #:continuable? _)
  1685:16  0 (raise-exception _ #:continuable? _)
ice-9/boot-9.scm:1685:16: In procedure raise-exception:
patch-el-files: unable to locate  "%s"
--8<---------------cut here---------------end--------------->8---

I added a comment before suggesting that wakatime-cli is not available, but
that was inaccurate.  The real cause is that 'patch-el-files can't handle the
following code:

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

And finally, it's wakatime-mode-test.el, the cases are so outdated that none
of them could pass...  There's no Makefile for 'check phase to run the test
either, so no need to adjust for it.

As a result, I think it's OK to add the package first without packaging the
wakatime-cli program.

Hilton Chain (1):
  gnu: Add emacs-wakatime-mode.

 gnu/packages/emacs-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)


base-commit: 01412c6c6a98e4da10676560638640d0f33e1a02
--
2.41.0




Information forwarded to andrew <at> trop.in, liliana.prikler <at> gmail.com, guix-patches <at> gnu.org:
bug#59552; Package guix-patches. (Sat, 15 Jul 2023 15:06:02 GMT) Full text and rfc822 format available.

Message #19 received at 59552 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: "59552 <at> debbugs.gnu.org"
Cc: Hilton Chain <hako <at> ultrarare.space>
Subject: [PATCH v2 1/1] gnu: Add emacs-wakatime-mode.
Date: Sat, 15 Jul 2023 23:05:16 +0800
* gnu/packages/emacs-xyz.scm (emacs-wakatime-mode): New variable.
---
 gnu/packages/emacs-xyz.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 480096fb50..84baf7ea32 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -37153,6 +37153,36 @@ (define-public emacs-mpv
 process via its IPC interface.")
       (license license:gpl3+))))
 
+(define-public emacs-wakatime-mode
+  ;; No release since May 5, 2015.
+  (let ((commit "ef923829912c3854d230834f81083814b7c9d992")
+        (revision "55"))
+    (package
+      (name "emacs-wakatime-mode")
+      ;; 1.0.2 on commit 32a0154cd4bbd525d354997e6b12c6a9726d0b43, not tagged
+      (version (git-version "1.0.2" 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
+                 ;; 'patch-el-files errors at "/bin/%s"
+                 (delete 'patch-el-files))))
+      (home-page "https://wakatime.com/emacs")
+      (synopsis "Automatic time tracking extension for Emacs using WakaTime")
+      (description
+       "WakaTime mode is an Emacs minor mode for automatic time tracking and
+metrics generated from your programming activity.")
+      (license license:gpl3+))))
+
 (define-public emacs-apel-lb
   ;; No release since Jun 15, 2010.
   (let ((version "10.8")                ;tag chise-base-0_25
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#59552; Package guix-patches. (Sun, 16 Jul 2023 07:18:02 GMT) Full text and rfc822 format available.

Message #22 received at 59552 <at> debbugs.gnu.org (full text, mbox):

From: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
To: Hilton Chain <hako <at> ultrarare.space>, 59552 <at> debbugs.gnu.org
Cc: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>, Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#59552] [PATCH v2 0/1] gnu: Add emacs-wakatime-mode.
Date: Sun, 16 Jul 2023 09:17:01 +0200
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  




Information forwarded to guix-patches <at> gnu.org:
bug#59552; Package guix-patches. (Tue, 18 Jul 2023 16:36:01 GMT) Full text and rfc822 format available.

Message #25 received at 59552 <at> debbugs.gnu.org (full text, mbox):

From: Hilton Chain <hako <at> ultrarare.space>
To: Liliana Marie Prikler <liliana.prikler <at> gmail.com>
Cc: Hilton Chain <hako <at> ultrarare.space>, 59552 <at> debbugs.gnu.org,
 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>, Andrew Tropin <andrew <at> trop.in>
Subject: Re: [bug#59552] [PATCH v2 0/1] gnu: Add emacs-wakatime-mode.
Date: Wed, 19 Jul 2023 00:35:25 +0800
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




Information forwarded to guix-patches <at> gnu.org:
bug#59552; Package guix-patches. (Sat, 18 May 2024 03:16:01 GMT) Full text and rfc822 format available.

Message #28 received at 59552 <at> debbugs.gnu.org (full text, mbox):

From: Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
To: Hilton Chain <hako <at> ultrarare.space>
Cc: Andrew Tropin <andrew <at> trop.in>,
 Liliana Marie Prikler <liliana.prikler <at> gmail.com>,
 Nicolas Goaziou <mail <at> nicolasgoaziou.fr>, 59552 <at> debbugs.gnu.org
Subject: Re: [bug#59552] [PATCH v2 0/1] gnu: Add emacs-wakatime-mode.
Date: Fri, 17 May 2024 23:14:08 -0400
Hi Hilton,

Hilton Chain <hako <at> ultrarare.space> writes:

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

There seems to not be much missing here.  Would you mind going through
past comments, attempting addressing them, and submit a v3?  Hopefully
it can then be merged.

-- 
Thanks,
Maxim




This bug report was last modified 1 year and 27 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.