guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Xinglu Chen
Subject: [bug#50709] [PATCH] gnu: Add zsh-syntax-highlighting.
Date: Sun, 26 Sep 2021 12:12:51 +0200

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: 0001-gnu-Add-zsh-syntax-highlighting.patch
Description: Text Data

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]