all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting.
@ 2021-09-20 23:03 Alexandr Vityazev
  2021-09-20 23:25 ` [bug#50709] [PATCH] gnu: shellutils: Add copyright Alexandr Vityazev
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Alexandr Vityazev @ 2021-09-20 23:03 UTC (permalink / raw)
  To: 50709

* gnu/packages/shellutils.scm (zsh-syntax-highlighting): New variable.
---
 gnu/packages/shellutils.scm | 55 +++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index 94b5536df7..69e1d0d069 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -138,6 +138,61 @@ text.")
 as you type.")
     (license license:expat)))
 
+(define-public zsh-syntax-highlighting
+  (package
+    (name "zsh-syntax-highlighting")
+    (version "0.7.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/zsh-users/zsh-syntax-highlighting")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "039g3n59drk818ylcyvkciv8k9mf739cv6v4vis1h9fv9whbcmwl"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("zsh" ,zsh)))
+    (arguments
+     ;; FIXME: Tests fail when running test regexp
+     ;; there is no pcre module in the Guix zsh package
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-before 'build 'add-all-md
+           (lambda _
+             (copy-file "docs/highlighters.md" "docs/all.md")
+             (make-file-writable "docs/all.md")
+             #t))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (invoke "make" "test")
+               (invoke "make" "perf"))
+             #t))
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (zsh-plugins
+                     (string-append out "/share/zsh/plugins/zsh-syntax-highlighting"))
+                    (highlighters-dir (string-append zsh-plugins "/highlighters")))
+               (invoke "make" "all")
+               (install-file "zsh-syntax-highlighting.zsh" zsh-plugins)
+               (install-file ".version" zsh-plugins)
+               (install-file ".revision-hash" zsh-plugins)
+               (copy-recursively "highlighters" highlighters-dir)
+               #t))))))
+    (home-page "https://github.com/zsh-users/zsh-syntax-highlighting")
+    (synopsis "Fish shell-like syntax highlighting for zsh")
+    (description
+     "This package provides syntax highlighting for the shell zsh.
+It enables highlighting of commands whilst they are typed at a zsh
+prompt into an interactive terminal.  This helps in reviewing commands
+before running them, particularly in catching syntax errors.")
+    (license license:expat)))
+
 (define-public sh-z
   (package
     (name "sh-z")
-- 
2.33.0



-- 

Alexandr Vityazev




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

* [bug#50709] [PATCH] gnu: shellutils: Add copyright.
  2021-09-20 23:03 [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting Alexandr Vityazev
@ 2021-09-20 23:25 ` Alexandr Vityazev
  2021-09-26 10:12 ` [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting Xinglu Chen
  2021-10-02 18:52 ` [bug#50709] [PATCH] v2 " Alexandr Vityazev
  2 siblings, 0 replies; 8+ messages in thread
From: Alexandr Vityazev @ 2021-09-20 23:25 UTC (permalink / raw)
  To: 50709

---
 gnu/packages/shellutils.scm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index 69e1d0d069..9091e9155f 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2020 aecepoglu <aecepoglu@fastmail.fm>
 ;;; Copyright © 2020 Dion Mendel <guix@dm9.info>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 Alexandr Vityazev <avityazev@posteo.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
-- 
2.33.0



-- 

Alexandr Vityazev




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

* [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting.
  2021-09-20 23:03 [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting Alexandr Vityazev
  2021-09-20 23:25 ` [bug#50709] [PATCH] gnu: shellutils: Add copyright Alexandr Vityazev
@ 2021-09-26 10:12 ` Xinglu Chen
  2021-09-27 14:09   ` Alexandr Vityazev
  2021-10-02 18:52 ` [bug#50709] [PATCH] v2 " Alexandr Vityazev
  2 siblings, 1 reply; 8+ messages in thread
From: Xinglu Chen @ 2021-09-26 10:12 UTC (permalink / raw)
  To: Alexandr Vityazev, 50709


[-- Attachment #1.1: Type: text/plain, Size: 3535 bytes --]

On Mon, Sep 20 2021, Alexandr Vityazev wrote:

> * gnu/packages/shellutils.scm (zsh-syntax-highlighting): New variable.
> ---
>  gnu/packages/shellutils.scm | 55 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 55 insertions(+)
>
> diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
> index 94b5536df7..69e1d0d069 100644
> --- a/gnu/packages/shellutils.scm
> +++ b/gnu/packages/shellutils.scm
> @@ -138,6 +138,61 @@ text.")
>  as you type.")
>      (license license:expat)))
>  
> +(define-public zsh-syntax-highlighting
> +  (package
> +    (name "zsh-syntax-highlighting")
> +    (version "0.7.1")
> +    (source (origin
> +              (method git-fetch)
> +              (uri (git-reference
> +                    (url "https://github.com/zsh-users/zsh-syntax-highlighting")
> +                    (commit version)))
> +              (file-name (git-file-name name version))
> +              (sha256
> +               (base32
> +                "039g3n59drk818ylcyvkciv8k9mf739cv6v4vis1h9fv9whbcmwl"))))
> +    (build-system gnu-build-system)
> +    (native-inputs
> +     `(("zsh" ,zsh)))
> +    (arguments
> +     ;; FIXME: Tests fail when running test regexp
> +     ;; there is no pcre module in the Guix zsh package
> +     `(#:tests? #f
> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (add-before 'build 'add-all-md
> +           (lambda _
> +             (copy-file "docs/highlighters.md" "docs/all.md")
> +             (make-file-writable "docs/all.md")
> +             #t))

Why not just invoke ‘make all’?

Also, phases no longer have to return #t

> +         (replace 'check
> +           (lambda* (#:key tests? #:allow-other-keys)
> +             (when tests?
> +               (invoke "make" "test")
> +               (invoke "make" "perf"))
> +             #t))
> +         (replace 'install
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out"))
> +                    (zsh-plugins
> +                     (string-append out "/share/zsh/plugins/zsh-syntax-highlighting"))
> +                    (highlighters-dir (string-append zsh-plugins "/highlighters")))
> +               (invoke "make" "all")

Why is ‘make all’ invoked in the ‘install’ phase?

> +               (install-file "zsh-syntax-highlighting.zsh" zsh-plugins)
> +               (install-file ".version" zsh-plugins)
> +               (install-file ".revision-hash" zsh-plugins)
> +               (copy-recursively "highlighters" highlighters-dir)

Wouldn’t these things be handled by ‘make install’, assuming that
‘PREFIX’ and ‘SHARE_DIR’ are set correctly.

> +               #t))))))
> +    (home-page "https://github.com/zsh-users/zsh-syntax-highlighting")
> +    (synopsis "Fish shell-like syntax highlighting for zsh")

“Zsh” should be capitalized.

> +    (description
> +     "This package provides syntax highlighting for the shell zsh.

“This package provides syntax highlighting for Zsh.”

> +It enables highlighting of commands whilst they are typed at a zsh

Capitalize “Zsh”.

> +prompt into an interactive terminal.  This helps in reviewing commands
> +before running them, particularly in catching syntax errors.")
> +    (license license:expat)))

‘COPYING.md’ says BSD-3.

And I couldn’t resist, so I just went ahead and made those changes…
:-)


[-- Attachment #1.2: 0001-gnu-Add-zsh-syntax-highlighting.patch --]
[-- Type: text/x-patch, Size: 3791 bytes --]

From 2cb00a93974f7efc7891e8f77fff1a3d96c7f692 Mon Sep 17 00:00:00 2001
Message-Id: <2cb00a93974f7efc7891e8f77fff1a3d96c7f692.1632651051.git.public@yoctocell.xyz>
From: Alexandr Vityazev <avityazev@posteo.org>
Date: Mon, 20 Sep 2021 23:03:29 +0000
Subject: [PATCH] gnu: Add zsh-syntax-highlighting.

* gnu/packages/shellutils.scm (zsh-syntax-highlighting): New variable.

Co-authored-by: Xinglu Chen <public@yoctocell.xyz>
---
 gnu/packages/shellutils.scm | 56 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index 94b5536df7..8726020ab3 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -10,6 +10,8 @@
 ;;; Copyright © 2020 aecepoglu <aecepoglu@fastmail.fm>
 ;;; Copyright © 2020 Dion Mendel <guix@dm9.info>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 Alexandr Vityazev <avityazev@posteo.org>
+;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,7 +48,8 @@ (define-module (gnu packages shellutils)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages ruby)
   #:use-module (gnu packages shells)
-  #:use-module (gnu packages tmux))
+  #:use-module (gnu packages tmux)
+  #:use-module (ice-9 regex))
 
 (define-public boxes
   (package
@@ -138,6 +141,57 @@ (define-public zsh-autosuggestions
 as you type.")
     (license license:expat)))
 
+(define-public zsh-syntax-highlighting
+  (package
+    (name "zsh-syntax-highlighting")
+    (version "0.7.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/zsh-users/zsh-syntax-highlighting")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "039g3n59drk818ylcyvkciv8k9mf739cv6v4vis1h9fv9whbcmwl"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("zsh" ,zsh)))
+    (arguments
+     ;; FIXME: Tests fail when running test regexp
+     ;; there is no pcre module in the Guix zsh package
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'patch-paths
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (substitute* "Makefile"
+                 (("/usr/local") out)
+                 ((,(regexp-quote "share/$(NAME)")) "share/zsh/plugins/$(NAME)")))))
+         (add-after 'patch-paths 'make-writable
+           (lambda _
+             (for-each make-file-writable
+                       '("docs/highlighters.md"
+                         "README.md"))))
+         (add-before 'build 'add-all-md
+           (lambda _
+             (invoke "make" "all")))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (invoke "make" "test")
+               (invoke "make" "perf")))))))
+    (home-page "https://github.com/zsh-users/zsh-syntax-highlighting")
+    (synopsis "Fish shell-like syntax highlighting for Zsh")
+    (description
+     "This package provides syntax highlighting for Zsh.  It enables
+highlighting of commands whilst they are typed at a Zsh prompt into an
+interactive terminal.  This helps in reviewing commands before running them,
+particularly in catching syntax errors.")
+    (license license:bsd-3)))
+
 (define-public sh-z
   (package
     (name "sh-z")

base-commit: c1bc2a43200d6c6016c2a4154799c73c86a54021
-- 
2.33.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

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

* [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting.
  2021-09-26 10:12 ` [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting Xinglu Chen
@ 2021-09-27 14:09   ` Alexandr Vityazev
  2021-10-02 15:18     ` Ludovic Courtès
  0 siblings, 1 reply; 8+ messages in thread
From: Alexandr Vityazev @ 2021-09-27 14:09 UTC (permalink / raw)
  To: Xinglu Chen; +Cc: 50709

On 2021-09-26, 12:12 +0200, Xinglu Chen <public@yoctocell.xyz> wrote:

>
> Why is ‘make all’ invoked in the ‘install’ phase?
>
Looks like carelessness and delirium.

I agree with all the comments, the attached patch is much better,
thanks for the corrections!

-- 

Alexandr Vityazev




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

* [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting.
  2021-09-27 14:09   ` Alexandr Vityazev
@ 2021-10-02 15:18     ` Ludovic Courtès
  2021-10-02 18:54       ` Alexandr Vityazev
  0 siblings, 1 reply; 8+ messages in thread
From: Ludovic Courtès @ 2021-10-02 15:18 UTC (permalink / raw)
  To: Alexandr Vityazev; +Cc: 50709, Xinglu Chen

Hi Alexandr,

Alexandr Vityazev <avityazev@posteo.org> skribis:

> On 2021-09-26, 12:12 +0200, Xinglu Chen <public@yoctocell.xyz> wrote:
>
>>
>> Why is ‘make all’ invoked in the ‘install’ phase?
>>
> Looks like carelessness and delirium.
>
> I agree with all the comments, the attached patch is much better,
> thanks for the corrections!

Looks like you forgot to attach the patch.  :-)

Ludo’.




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

* [bug#50709] [PATCH] v2 gnu: Add zsh-syntax-highlighting.
  2021-09-20 23:03 [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting Alexandr Vityazev
  2021-09-20 23:25 ` [bug#50709] [PATCH] gnu: shellutils: Add copyright Alexandr Vityazev
  2021-09-26 10:12 ` [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting Xinglu Chen
@ 2021-10-02 18:52 ` Alexandr Vityazev
  2021-10-13  8:40   ` bug#50709: [PATCH] " Ludovic Courtès
  2 siblings, 1 reply; 8+ messages in thread
From: Alexandr Vityazev @ 2021-10-02 18:52 UTC (permalink / raw)
  To: 50709

* gnu/packages/shellutils.scm (zsh-syntax-highlighting): New variable.
---
 gnu/packages/shellutils.scm | 56 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 55 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/shellutils.scm b/gnu/packages/shellutils.scm
index 94b5536df7..8726020ab3 100644
--- a/gnu/packages/shellutils.scm
+++ b/gnu/packages/shellutils.scm
@@ -10,6 +10,8 @@
 ;;; Copyright © 2020 aecepoglu <aecepoglu@fastmail.fm>
 ;;; Copyright © 2020 Dion Mendel <guix@dm9.info>
 ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
+;;; Copyright © 2021 Alexandr Vityazev <avityazev@posteo.org>
+;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -46,7 +48,8 @@
   #:use-module (gnu packages readline)
   #:use-module (gnu packages ruby)
   #:use-module (gnu packages shells)
-  #:use-module (gnu packages tmux))
+  #:use-module (gnu packages tmux)
+  #:use-module (ice-9 regex))
 
 (define-public boxes
   (package
@@ -138,6 +141,57 @@ text.")
 as you type.")
     (license license:expat)))
 
+(define-public zsh-syntax-highlighting
+  (package
+    (name "zsh-syntax-highlighting")
+    (version "0.7.1")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/zsh-users/zsh-syntax-highlighting")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "039g3n59drk818ylcyvkciv8k9mf739cv6v4vis1h9fv9whbcmwl"))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("zsh" ,zsh)))
+    (arguments
+     ;; FIXME: Tests fail when running test regexp
+     ;; there is no pcre module in the Guix zsh package
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (add-after 'unpack 'patch-paths
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (substitute* "Makefile"
+                 (("/usr/local") out)
+                 ((,(regexp-quote "share/$(NAME)")) "share/zsh/plugins/$(NAME)")))))
+         (add-after 'patch-paths 'make-writable
+           (lambda _
+             (for-each make-file-writable
+                       '("docs/highlighters.md"
+                         "README.md"))))
+         (add-before 'build 'add-all-md
+           (lambda _
+             (invoke "make" "all")))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               (invoke "make" "test")
+               (invoke "make" "perf")))))))
+    (home-page "https://github.com/zsh-users/zsh-syntax-highlighting")
+    (synopsis "Fish shell-like syntax highlighting for Zsh")
+    (description
+     "This package provides syntax highlighting for Zsh.  It enables
+highlighting of commands whilst they are typed at a Zsh prompt into an
+interactive terminal.  This helps in reviewing commands before running them,
+particularly in catching syntax errors.")
+    (license license:bsd-3)))
+
 (define-public sh-z
   (package
     (name "sh-z")
-- 
2.33.0



-- 

Alexandr Vityazev




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

* [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting.
  2021-10-02 15:18     ` Ludovic Courtès
@ 2021-10-02 18:54       ` Alexandr Vityazev
  0 siblings, 0 replies; 8+ messages in thread
From: Alexandr Vityazev @ 2021-10-02 18:54 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Xinglu Chen, 50709


Hi Ludo’,

On 2021-10-02, 17:18 +0200, Ludovic Courtès <ludo@gnu.org> wrote:

> Hi Alexandr,
>
> Alexandr Vityazev <avityazev@posteo.org> skribis:
>
>> On 2021-09-26, 12:12 +0200, Xinglu Chen <public@yoctocell.xyz> wrote:
>>
>>>
>>> Why is ‘make all’ invoked in the ‘install’ phase?
>>>
>> Looks like carelessness and delirium.
>>
>> I agree with all the comments, the attached patch is much better,
>> thanks for the corrections!
>
> Looks like you forgot to attach the patch.  :-)
>

Oh, sorry about that. I sent it.


-- 

Alexandr Vityazev




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

* bug#50709: [PATCH] gnu: Add zsh-syntax-highlighting.
  2021-10-02 18:52 ` [bug#50709] [PATCH] v2 " Alexandr Vityazev
@ 2021-10-13  8:40   ` Ludovic Courtès
  0 siblings, 0 replies; 8+ messages in thread
From: Ludovic Courtès @ 2021-10-13  8:40 UTC (permalink / raw)
  To: Alexandr Vityazev; +Cc: 50709-done

Hi,

Alexandr Vityazev <avityazev@posteo.org> skribis:

> * gnu/packages/shellutils.scm (zsh-syntax-highlighting): New variable.

Applied!  I took the liberty to remove the ‘regexp-quote’ call, which I
think did not help readability.

Thanks,
Ludo’.




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

end of thread, other threads:[~2021-10-13  8:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-20 23:03 [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting Alexandr Vityazev
2021-09-20 23:25 ` [bug#50709] [PATCH] gnu: shellutils: Add copyright Alexandr Vityazev
2021-09-26 10:12 ` [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting Xinglu Chen
2021-09-27 14:09   ` Alexandr Vityazev
2021-10-02 15:18     ` Ludovic Courtès
2021-10-02 18:54       ` Alexandr Vityazev
2021-10-02 18:52 ` [bug#50709] [PATCH] v2 " Alexandr Vityazev
2021-10-13  8:40   ` bug#50709: [PATCH] " Ludovic Courtès

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.