[PATCH 0/1] Add z for zsh

DoneSubmitted by Collin J. Doering.
Details
2 participants
  • Collin J. Doering
  • Ludovic Courtès
Owner
unassigned
Severity
normal
C
C
Collin J. Doering wrote on 10 Sep 2019 04:40
(address . guix-patches@gnu.org)
87woeg3mcy.fsf@rekahsoft.ca
Add the small zsh utility for quickly switching directories based on
past usage.

Collin J. Doering (1):
gnu: Add z for zsh

gnu/packages/shellutils.scm | 44 +++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)

--
Collin J. Doering

C
C
Collin J. Doering wrote on 10 Sep 2019 04:45
[PATCH 1/1] gnu: Add z for zsh
(address . 37364@debbugs.gnu.org)
87v9u03m3m.fsf@rekahsoft.ca
* gnu/packages/shellutils.scm (z): New variable.

Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>
---
gnu/packages/shellutils.scm | 44 +++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)

Toggle diff (62 lines)
diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index f7542ea759..f4e8e0fbdb 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -33,11 +33,55 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages compression)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system python))
 
+(define-public z
+  (package
+    (name "z")
+    (version "1.11")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rupa/z.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("gzip" ,gzip)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (delete 'check)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (man-path (string-append out "/share/man/man1"))
+                    (install-path (string-append out "/bin")))
+               (mkdir-p install-path)
+               (copy-file "z.sh" (string-append install-path "/z.sh"))
+               (chmod (string-append install-path "/z.sh") #o755)
+
+               (mkdir-p man-path)
+               (invoke "gzip" "z.1")
+               (copy-file "z.1.gz" (string-append man-path "/z.1.gz"))
+               (chmod (string-append man-path "/z.1.gz") #o744)))))))
+    (synopsis "Jump about directories")
+    (description
+     "Tracks your most used directories, based on freecency.  After a short
+learning phase, z will take you to the most frecent directory that matches
+ALL of the regexes given on the command line in order.")
+    (home-page "https://github.com/rupa/z")
+    (license license:expat)))
+
 (define-public envstore
   (package
     (name "envstore")
-- 
2.23.0
C
C
Collin J. Doering wrote on 10 Sep 2019 16:41
[PATCH] - Amended: Add copyright line and gpg sign email
(address . 37364@debbugs.gnu.org)
87pnk82oyt.fsf@rekahsoft.ca
Did not add a copyright line to the modified file in this patch. I have
fixed this and updated the patch accordingly. Additionally I have signed
this email.

Kind regards,

--
Collin J. Doering

From 299cb02e12cc13dbdb762d6b4ea3ca791556dcaa Mon Sep 17 00:00:00 2001
From: "Collin J. Doering" <collin@rekahsoft.ca>
Date: Tue, 10 Sep 2019 10:38:04 -0400
Subject: [PATCH] gnu: Add z for zsh

* gnu/packages/shellutils.scm (z): New variable.

Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>
---
gnu/packages/shellutils.scm | 45 +++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

Toggle diff (70 lines)
diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index f7542ea759..878620d8c0 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
+;;; Copyright © 2019 Collin J. Doering <collin@rekahsoft.ca>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33,11 +34,55 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages compression)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system python))
 
+(define-public z
+  (package
+    (name "z")
+    (version "1.11")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rupa/z.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("gzip" ,gzip)))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (delete 'check)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (man-path (string-append out "/share/man/man1"))
+                    (install-path (string-append out "/bin")))
+               (mkdir-p install-path)
+               (copy-file "z.sh" (string-append install-path "/z.sh"))
+               (chmod (string-append install-path "/z.sh") #o755)
+
+               (mkdir-p man-path)
+               (invoke "gzip" "z.1")
+               (copy-file "z.1.gz" (string-append man-path "/z.1.gz"))
+               (chmod (string-append man-path "/z.1.gz") #o744)))))))
+    (synopsis "Jump about directories")
+    (description
+     "Tracks your most used directories, based on freecency.  After a short
+learning phase, z will take you to the most frecent directory that matches
+ALL of the regexes given on the command line in order.")
+    (home-page "https://github.com/rupa/z")
+    (license license:expat)))
+
 (define-public envstore
   (package
     (name "envstore")
-- 
2.23.0
L
L
Ludovic Courtès wrote on 11 Sep 2019 14:23
Re: [bug#37364] [PATCH 1/1] gnu: Add z for zsh
(name . Collin J. Doering)(address . collin@rekahsoft.ca)(address . 37364@debbugs.gnu.org)
87d0g7vx6y.fsf@gnu.org
Hello Collin,

"Collin J. Doering" <collin@rekahsoft.ca> skribis:

Toggle quote (4 lines)
> * gnu/packages/shellutils.scm (z): New variable.
>
> Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>

[...]

Toggle quote (4 lines)
> +(define-public z
> + (package
> + (name "z")

So far there’s only one package with a one-letter name. I’d be tempted
to rename “z” to “sh-z” (because it works with both Zsh and Bash) or
something similar, WDYT?

Toggle quote (4 lines)
> + (mkdir-p man-path)
> + (invoke "gzip" "z.1")
> + (copy-file "z.1.gz" (string-append man-path "/z.1.gz"))

You can omit the “gzip” invocation because the ‘compress-documentation’
phase takes care of that, and passes the ‘-n’ flag, which is important
for bitwise reproducibility.

Also, you can remove the ‘mkdir-p’ call and replace the ‘copy-file’ call
with:

(install-file "z.1" man)

Last: please remove ‘-path’ from variable names—in GNU the convention is
touse the term “path” only for search paths ($PATH, etc.)

Toggle quote (6 lines)
> + (synopsis "Jump about directories")
> + (description
> + "Tracks your most used directories, based on freecency. After a short
> +learning phase, z will take you to the most frecent directory that matches
> +ALL of the regexes given on the command line in order.")

It’s suggest writing “``frecency''” (with quotes) to make it clear that
it’s not a typo. :-)

Could you send an updated patch?

Thanks,
Ludo’.
C
C
Collin J. Doering wrote on 12 Sep 2019 05:13
(name . Ludovic Courtès)(address . ludo@gnu.org)
87lfuu2on5.fsf@rekahsoft.ca
Hi Ludovic,

On 11 Sep 2019 at 08:23, Ludovic Courtès wrote:

Toggle quote (18 lines)
> Hello Collin,
>
> "Collin J. Doering" <collin@rekahsoft.ca> skribis:
>
>> * gnu/packages/shellutils.scm (z): New variable.
>>
>> Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>
>
> [...]
>
>> +(define-public z
>> + (package
>> + (name "z")
>
> So far there’s only one package with a one-letter name. I’d be tempted
> to rename “z” to “sh-z” (because it works with both Zsh and Bash) or
> something similar, WDYT?

I felt uncomfortable with just `z` so I'm happy to change it to `sh-z`.

Toggle quote (9 lines)
>
>> + (mkdir-p man-path)
>> + (invoke "gzip" "z.1")
>> + (copy-file "z.1.gz" (string-append man-path "/z.1.gz"))
>
> You can omit the “gzip” invocation because the ‘compress-documentation’
> phase takes care of that, and passes the ‘-n’ flag, which is important
> for bitwise reproducibility.

Makes sense, we wouldn't want timestamps. My mistake.

Toggle quote (9 lines)
>
> Also, you can remove the ‘mkdir-p’ call and replace the ‘copy-file’ call
> with:
>
> (install-file "z.1" man)
>
> Last: please remove ‘-path’ from variable names—in GNU the convention is
> touse the term “path” only for search paths ($PATH, etc.)

Thanks for pointing this out. After going to review some uses of the
`install-file` function, I see this is certainly the case.

Toggle quote (10 lines)
>
>> + (synopsis "Jump about directories")
>> + (description
>> + "Tracks your most used directories, based on freecency. After a short
>> +learning phase, z will take you to the most frecent directory that matches
>> +ALL of the regexes given on the command line in order.")
>
> It’s suggest writing “``frecency''” (with quotes) to make it clear that
> it’s not a typo. :-)

Agree.

Toggle quote (6 lines)
>
> Could you send an updated patch?
>
> Thanks,
> Ludo’.

You will find an updated patch as part of this email with the above
changes.

Kind regards, and thanks for the helpful feedback.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEE+NVG868371PRtki+e03rkyErMCIFAl15t78ACgkQe03rkyEr
MCKNkQf/THbkO1memh7C1gQAcgkP69I/0KlgjRLtxz4YDk36q80cE6VQS71LbjUj
qVYHYNpyt/3LxP2WPzjItIYCFxBwhyL1cnq1OPvc+acr3DjxJblW3Ft/LRznMRgU
lQun0jS5S0HqXTSsics6mHiVYGpogcGqVvSUfX6MXSGa71IXvzO91wNDRSG5HnL7
zDhAu5ox9+Hz/FGrkakTLV+3CHrvIjR1fAjnMQifzz3CRmZioc7YAsl8Oe/77Fcf
ZYF7V8yC/nOCtavyUKfqNlTaGhTfN8UVfZiPwMFNmrRneUoAVCzb5I6Y8DnGY9J6
MP9rHkxwM6z7fzJ/iVborbYypLqckQ==
=yHUL
-----END PGP SIGNATURE-----

From f5fd56da740cd2576def4c01c3cc7003f1c9f2d7 Mon Sep 17 00:00:00 2001
From: "Collin J. Doering" <collin@rekahsoft.ca>
Date: Wed, 11 Sep 2019 23:08:37 -0400
Subject: [PATCH] gnu: Add sh-z shell tool

* gnu/packages/shellutils.scm (sh-z): New variable.

Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>
---
gnu/packages/shellutils.scm | 38 +++++++++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)

Toggle diff (63 lines)
diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index f7542ea759..bbdfd0dadd 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2017 Stefan Reichör <stefan@xsteve.at>
 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2018 Benjamin Slade <slade@jnanam.net>
+;;; Copyright © 2019 Collin J. Doering <collin@rekahsoft.ca>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -33,11 +34,48 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages pkg-config)
+  #:use-module (gnu packages compression)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
   #:use-module (guix build-system python))
 
+(define-public sh-z
+  (package
+    (name "sh-z")
+    (version "1.11")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/rupa/z.git")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "13zbgkj6y0qhvn5jpkrqbd4jjxjr789k228iwma5hjfh1nx7ghyb"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ; No tests provided
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (delete 'build)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (man (string-append out "/share/man/man1"))
+                    (bin (string-append out "/bin")))
+               (install-file "z.sh" bin)
+               (chmod (string-append bin "/z.sh") #o755)
+               (install-file "z.1" man)))))))
+    (synopsis "Jump about directories")
+    (description
+     "Tracks your most used directories, based on ``frecency''.  After a short
+learning phase, z will take you to the most ``frecent'' directory that matches
+ALL of the regexes given on the command line in order.")
+    (home-page "https://github.com/rupa/z")
+    (license license:expat)))
+
 (define-public envstore
   (package
     (name "envstore")
-- 
2.23.0
L
L
Ludovic Courtès wrote on 13 Sep 2019 10:47
(name . Collin J. Doering)(address . collin@rekahsoft.ca)(address . 37364@debbugs.gnu.org)
87r24k8tvy.fsf@gnu.org
Hello,

"Collin J. Doering" <collin@rekahsoft.ca> skribis:

Toggle quote (9 lines)
> From f5fd56da740cd2576def4c01c3cc7003f1c9f2d7 Mon Sep 17 00:00:00 2001
> From: "Collin J. Doering" <collin@rekahsoft.ca>
> Date: Wed, 11 Sep 2019 23:08:37 -0400
> Subject: [PATCH] gnu: Add sh-z shell tool
>
> * gnu/packages/shellutils.scm (sh-z): New variable.
>
> Signed-off-by: Collin J. Doering <collin@rekahsoft.ca>

Applied with the tiny changes below.

Note: We reserve ‘Signed-off-by’ for those who commit on your behalf, so
you don’t need to provide it.

Thank you,
Ludo’.
Toggle diff (27 lines)
diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index bbdfd0dadd..f901eaaa8f 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -34,7 +34,6 @@
   #:use-module (gnu packages ncurses)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages pkg-config)
-  #:use-module (gnu packages compression)
   #:use-module (guix utils)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system go)
@@ -67,12 +66,13 @@
                     (bin (string-append out "/bin")))
                (install-file "z.sh" bin)
                (chmod (string-append bin "/z.sh") #o755)
-               (install-file "z.1" man)))))))
+               (install-file "z.1" man)
+               #t))))))
     (synopsis "Jump about directories")
     (description
      "Tracks your most used directories, based on ``frecency''.  After a short
 learning phase, z will take you to the most ``frecent'' directory that matches
-ALL of the regexes given on the command line in order.")
+all of the regexes given on the command line in order.")
     (home-page "https://github.com/rupa/z")
     (license license:expat)))
L
L
Ludovic Courtès wrote on 13 Sep 2019 10:48
control message for bug #37364
(address . control@debbugs.gnu.org)
87pnk48tvf.fsf@gnu.org
tags 37364 fixed
close 37364
quit
?
Your comment

This issue is archived.

To comment on this conversation send email to 37364@debbugs.gnu.org