From patchwork Sat Oct 2 18:52:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Aleksandr Vityazev X-Patchwork-Id: 33581 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 39CAE27BBE3; Sat, 2 Oct 2021 19:53:18 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id D496C27BBE1 for ; Sat, 2 Oct 2021 19:53:17 +0100 (BST) Received: from localhost ([::1]:42832 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWk8L-0006oL-09 for patchwork@mira.cbaines.net; Sat, 02 Oct 2021 14:53:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWk87-0006nY-R0 for guix-patches@gnu.org; Sat, 02 Oct 2021 14:53:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49029) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWk86-0004rB-Hm for guix-patches@gnu.org; Sat, 02 Oct 2021 14:53:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mWk86-0007rL-7U for guix-patches@gnu.org; Sat, 02 Oct 2021 14:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50709] [PATCH] v2 gnu: Add zsh-syntax-highlighting. References: <87sfxy4zpa.fsf@posteo.org> In-Reply-To: <87sfxy4zpa.fsf@posteo.org> Resent-From: Alexandr Vityazev Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 02 Oct 2021 18:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50709 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50709@debbugs.gnu.org Received: via spool by 50709-submit@debbugs.gnu.org id=B50709.163320073530039 (code B ref 50709); Sat, 02 Oct 2021 18:53:02 +0000 Received: (at 50709) by debbugs.gnu.org; 2 Oct 2021 18:52:15 +0000 Received: from localhost ([127.0.0.1]:60575 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWk7F-0007oL-Ng for submit@debbugs.gnu.org; Sat, 02 Oct 2021 14:52:15 -0400 Received: from mout01.posteo.de ([185.67.36.65]:56869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWk7C-0007nn-Na for 50709@debbugs.gnu.org; Sat, 02 Oct 2021 14:52:08 -0400 Received: from submission (posteo.de [89.146.220.130]) by mout01.posteo.de (Postfix) with ESMTPS id 16CB2240026 for <50709@debbugs.gnu.org>; Sat, 2 Oct 2021 20:51:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.org; s=2017; t=1633200720; bh=iGi6HrEU6kTr5EiXAWkyz8zNbrExUCbOVoiluTtRAuA=; h=From:To:Subject:Date:From; b=XNydfVpkXqR7gGpQLWgHmLCrVHTj9p+cGEcFYnCXqxc1izUZeDTpPMv6qKvOXCNO+ VYoku4w4f+TVa1nL3st30Mh93+Ccb+g9KkAtdcTDCnGyfKaynwbX/B9NQhkF55Cjkk 4DSF1Nk+oMNZIo7yJEJU7cnt8UL6i//41TqwvuOF0m6q5y+imFuFf2ammzP5FqtwwU EV57tzT6gJ7Yg5Dd9a/PfS/XUqlFgmnq2/vbBpb+ZbzhVeWcF09oovCsfv3DF+G8Gc jOHjVeOnsxweg+rTTFJUwG5Jhn8+cVRF+YHaO1inlZW9Z/N9Yc+997K4KjmqtYF0rp HFmGKmiO73e4w== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4HMGL66X6Fz6tm5 for <50709@debbugs.gnu.org>; Sat, 2 Oct 2021 20:51:58 +0200 (CEST) From: Alexandr Vityazev Date: Sat, 02 Oct 2021 18:52:00 +0000 Message-ID: <8735pj5kfj.fsf@posteo.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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 ;;; Copyright © 2020 Dion Mendel ;;; Copyright © 2021 Brice Waegeneire +;;; Copyright © 2021 Alexandr Vityazev +;;; Copyright © 2021 Xinglu Chen ;;; ;;; 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")