unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#59552] [PATCH] gnu: Add emacs-wakatime-mode.
@ 2022-11-25  1:15 Hilton Chain via Guix-patches via
  2022-11-26 10:21 ` Nicolas Goaziou
  2023-07-15 15:01 ` [bug#59552] [PATCH v2 0/1] " Hilton Chain via Guix-patches via
  0 siblings, 2 replies; 6+ messages in thread
From: Hilton Chain via Guix-patches via @ 2022-11-25  1:15 UTC (permalink / raw)
  To: 59552; +Cc: Hilton Chain

* 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




^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#59552] [PATCH] gnu: Add emacs-wakatime-mode.
  2022-11-25  1:15 [bug#59552] [PATCH] gnu: Add emacs-wakatime-mode Hilton Chain via Guix-patches via
@ 2022-11-26 10:21 ` Nicolas Goaziou
  2023-07-15 15:01 ` [bug#59552] [PATCH v2 0/1] " Hilton Chain via Guix-patches via
  1 sibling, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2022-11-26 10:21 UTC (permalink / raw)
  To: 59552; +Cc: hako

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,
-- 
Nicolas Goaziou




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#59552] [PATCH v2 0/1] gnu: Add emacs-wakatime-mode.
  2022-11-25  1:15 [bug#59552] [PATCH] gnu: Add emacs-wakatime-mode Hilton Chain via Guix-patches via
  2022-11-26 10:21 ` Nicolas Goaziou
@ 2023-07-15 15:01 ` Hilton Chain via Guix-patches via
  2023-07-15 15:05   ` [bug#59552] [PATCH v2 1/1] " Hilton Chain via Guix-patches via
  2023-07-16  7:17   ` [bug#59552] [PATCH v2 0/1] " Liliana Marie Prikler
  1 sibling, 2 replies; 6+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-07-15 15:01 UTC (permalink / raw)
  To: 59552; +Cc: Hilton Chain, Nicolas Goaziou, Andrew Tropin,
	Liliana Marie Prikler

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#59552] [PATCH v2 1/1] gnu: Add emacs-wakatime-mode.
  2023-07-15 15:01 ` [bug#59552] [PATCH v2 0/1] " Hilton Chain via Guix-patches via
@ 2023-07-15 15:05   ` Hilton Chain via Guix-patches via
  2023-07-16  7:17   ` [bug#59552] [PATCH v2 0/1] " Liliana Marie Prikler
  1 sibling, 0 replies; 6+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-07-15 15:05 UTC (permalink / raw)
  To: "59552; +Cc: Hilton Chain, Andrew Tropin, Liliana Marie Prikler

* 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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#59552] [PATCH v2 0/1] gnu: Add emacs-wakatime-mode.
  2023-07-15 15:01 ` [bug#59552] [PATCH v2 0/1] " Hilton Chain via Guix-patches via
  2023-07-15 15:05   ` [bug#59552] [PATCH v2 1/1] " Hilton Chain via Guix-patches via
@ 2023-07-16  7:17   ` Liliana Marie Prikler
  2023-07-18 16:35     ` Hilton Chain via Guix-patches via
  1 sibling, 1 reply; 6+ messages in thread
From: Liliana Marie Prikler @ 2023-07-16  7:17 UTC (permalink / raw)
  To: Hilton Chain, 59552; +Cc: Nicolas Goaziou, Andrew Tropin

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  




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#59552] [PATCH v2 0/1] gnu: Add emacs-wakatime-mode.
  2023-07-16  7:17   ` [bug#59552] [PATCH v2 0/1] " Liliana Marie Prikler
@ 2023-07-18 16:35     ` Hilton Chain via Guix-patches via
  0 siblings, 0 replies; 6+ messages in thread
From: Hilton Chain via Guix-patches via @ 2023-07-18 16:35 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: Hilton Chain, 59552, Nicolas Goaziou, Andrew Tropin

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




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-18 16:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25  1:15 [bug#59552] [PATCH] gnu: Add emacs-wakatime-mode Hilton Chain via Guix-patches via
2022-11-26 10:21 ` Nicolas Goaziou
2023-07-15 15:01 ` [bug#59552] [PATCH v2 0/1] " Hilton Chain via Guix-patches via
2023-07-15 15:05   ` [bug#59552] [PATCH v2 1/1] " Hilton Chain via Guix-patches via
2023-07-16  7:17   ` [bug#59552] [PATCH v2 0/1] " Liliana Marie Prikler
2023-07-18 16:35     ` Hilton Chain via Guix-patches via

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).