GNU bug report logs - #50709
[PATCH] gnu: Add zsh-syntax-highlighting.

Previous Next

Package: guix-patches;

Reported by: Alexandr Vityazev <avityazev <at> posteo.org>

Date: Mon, 20 Sep 2021 23:04:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50709 in the body.
You can then email your comments to 50709 AT debbugs.gnu.org in the normal way.

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#50709; Package guix-patches. (Mon, 20 Sep 2021 23:04:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Alexandr Vityazev <avityazev <at> posteo.org>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 20 Sep 2021 23:04:02 GMT) Full text and rfc822 format available.

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

From: Alexandr Vityazev <avityazev <at> posteo.org>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add zsh-syntax-highlighting.
Date: Mon, 20 Sep 2021 23:03:29 +0000
* 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




Information forwarded to guix-patches <at> gnu.org:
bug#50709; Package guix-patches. (Mon, 20 Sep 2021 23:26:01 GMT) Full text and rfc822 format available.

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

From: Alexandr Vityazev <avityazev <at> posteo.org>
To: 50709 <at> debbugs.gnu.org
Subject: [PATCH] gnu: shellutils: Add copyright.
Date: Mon, 20 Sep 2021 23:25:12 +0000
---
 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 <at> fastmail.fm>
 ;;; Copyright © 2020 Dion Mendel <guix <at> dm9.info>
 ;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
+;;; Copyright © 2021 Alexandr Vityazev <avityazev <at> posteo.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
-- 
2.33.0



-- 

Alexandr Vityazev




Information forwarded to guix-patches <at> gnu.org:
bug#50709; Package guix-patches. (Sun, 26 Sep 2021 10:14:02 GMT) Full text and rfc822 format available.

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

From: Xinglu Chen <public <at> yoctocell.xyz>
To: Alexandr Vityazev <avityazev <at> posteo.org>, 50709 <at> debbugs.gnu.org
Subject: Re: [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting.
Date: Sun, 26 Sep 2021 12:12:51 +0200
[Message part 1 (text/plain, inline)]
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…
:-)

[0001-gnu-Add-zsh-syntax-highlighting.patch (text/x-patch, attachment)]
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50709; Package guix-patches. (Mon, 27 Sep 2021 14:10:02 GMT) Full text and rfc822 format available.

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

From: Alexandr Vityazev <avityazev <at> posteo.org>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 50709 <at> debbugs.gnu.org
Subject: Re: bug#50709: [PATCH] gnu: Add zsh-syntax-highlighting.
Date: Mon, 27 Sep 2021 14:09:26 +0000
On 2021-09-26, 12:12 +0200, Xinglu Chen <public <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#50709; Package guix-patches. (Sat, 02 Oct 2021 15:20:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Alexandr Vityazev <avityazev <at> posteo.org>
Cc: 50709 <at> debbugs.gnu.org, Xinglu Chen <public <at> yoctocell.xyz>
Subject: Re: bug#50709: [PATCH] gnu: Add zsh-syntax-highlighting.
Date: Sat, 02 Oct 2021 17:18:58 +0200
Hi Alexandr,

Alexandr Vityazev <avityazev <at> posteo.org> skribis:

> On 2021-09-26, 12:12 +0200, Xinglu Chen <public <at> 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’.




Information forwarded to guix-patches <at> gnu.org:
bug#50709; Package guix-patches. (Sat, 02 Oct 2021 18:53:02 GMT) Full text and rfc822 format available.

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

From: Alexandr Vityazev <avityazev <at> posteo.org>
To: 50709 <at> debbugs.gnu.org
Subject: [PATCH] v2 gnu: Add zsh-syntax-highlighting.
Date: Sat, 02 Oct 2021 18:52:00 +0000
* 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 <at> fastmail.fm>
 ;;; Copyright © 2020 Dion Mendel <guix <at> dm9.info>
 ;;; Copyright © 2021 Brice Waegeneire <brice <at> waegenei.re>
+;;; Copyright © 2021 Alexandr Vityazev <avityazev <at> posteo.org>
+;;; Copyright © 2021 Xinglu Chen <public <at> 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




Information forwarded to guix-patches <at> gnu.org:
bug#50709; Package guix-patches. (Sat, 02 Oct 2021 18:55:02 GMT) Full text and rfc822 format available.

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

From: Alexandr Vityazev <avityazev <at> posteo.org>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: Xinglu Chen <public <at> yoctocell.xyz>, 50709 <at> debbugs.gnu.org
Subject: Re: bug#50709: [PATCH] gnu: Add zsh-syntax-highlighting.
Date: Sat, 02 Oct 2021 18:54:46 +0000
Hi Ludo’,

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

> Hi Alexandr,
>
> Alexandr Vityazev <avityazev <at> posteo.org> skribis:
>
>> On 2021-09-26, 12:12 +0200, Xinglu Chen <public <at> 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




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Wed, 13 Oct 2021 08:42:02 GMT) Full text and rfc822 format available.

Notification sent to Alexandr Vityazev <avityazev <at> posteo.org>:
bug acknowledged by developer. (Wed, 13 Oct 2021 08:42:02 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Alexandr Vityazev <avityazev <at> posteo.org>
Cc: 50709-done <at> debbugs.gnu.org
Subject: Re: bug#50709: [PATCH] gnu: Add zsh-syntax-highlighting.
Date: Wed, 13 Oct 2021 10:40:52 +0200
Hi,

Alexandr Vityazev <avityazev <at> 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’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 10 Nov 2021 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 173 days ago.

Previous Next


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