From debbugs-submit-bounces@debbugs.gnu.org Sat Mar 12 16:10:20 2022 Received: (at submit) by debbugs.gnu.org; 12 Mar 2022 21:10:20 +0000 Received: from localhost ([127.0.0.1]:40935 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nT90G-0002vN-Go for submit@debbugs.gnu.org; Sat, 12 Mar 2022 16:10:20 -0500 Received: from lists.gnu.org ([209.51.188.17]:49172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nT90F-0002vF-6A for submit@debbugs.gnu.org; Sat, 12 Mar 2022 16:10:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35762) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nT90E-0005MD-2O for guix-patches@gnu.org; Sat, 12 Mar 2022 16:10:18 -0500 Received: from knopi.disroot.org ([178.21.23.139]:55514) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nT90A-0002La-1X for guix-patches@gnu.org; Sat, 12 Mar 2022 16:10:16 -0500 Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id ADB1740072; Sat, 12 Mar 2022 22:10:08 +0100 (CET) X-Virus-Scanned: SPAM Filter at disroot.org Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nznIvS9fP-dO; Sat, 12 Mar 2022 22:10:07 +0100 (CET) From: "(unmatched-parenthesis" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1647119406; bh=9d/snAVl28Jg00psS2cG9FkYksB/VO4ShvJmMW44Tx8=; h=From:To:Cc:Subject:Date; b=f/4anuRfYuE1AVp5QPSs2rfmMjClEaeMRfPQkY53D7N+Hmvza6fWvbfp5DIRLQW5J TyWtUU3jyS3zs/U575eDC3Mxi0ZAXBFxlTV+E343YKPA+ghhUzrx7BkSWmfwBJ0tj3 Lb+yuZeM2LrEFp9urK1cLzNTOkWUfnPL4uwt/tuEbJ6+Y5hdCL88n93oUE48OKNOG5 +sXchv+3zHD8gFpfXSmi1xiLljOvqjaR5wkqYHjpL8t0MPmPI8HE6hAKAztJ8f85w/ mg+tbHV99mLdWFMPUGt6HJFgemw6lYSDM6tO7bsPXKrGFfYyClr0mMnNE/oqKD7Jfl l0KQW7tPuwSZg== To: guix-patches@gnu.org Subject: [PATCH] gnu: kakoune: Clean up, and add a search path that makes it possible to package kak plugins in guix. (Plugins incoming soon.) Date: Sat, 12 Mar 2022 21:09:40 +0000 Message-Id: <20220312210940.15397-1-paren@disroot.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=178.21.23.139; envelope-from=paren@disroot.org; helo=knopi.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit Cc: "\(unmatched-parenthesis" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) * gnu/packages/text-editors.scm(kakoune): Remove the redundant `#t`s, and add a $GUIX_KAKOUNE_CONFIG_DIRS search path. While trying to package a kak plugin, I realized that the kak package itself was missing a search path. However, kak appears to allow only one config path, so I inject a for loop into the default kakrc (with a hacky substitute* because i cannot be bothered preparing a path :) which enumerates the paths in $GUIX_KAKOUNE_CONFIG_DIRS and sources all their kakfiles. I'll send in a few plugins in a moment. These will act as both examples of the search path working and of course useful packages in themselves. I also took the opportunity to clean the package up a little, removing the now unneccesary `#t`s returned at the end of each phase. I was going to change it to use git instead of github release tarballs too (I'm told that git clones are better because of Software Heritage), but I'm hesitant to make that change without checking first. --- gnu/packages/text-editors.scm | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/gnu/packages/text-editors.scm b/gnu/packages/text-editors.scm index 45cc61765a..6d562d0e4a 100644 --- a/gnu/packages/text-editors.scm +++ b/gnu/packages/text-editors.scm @@ -17,6 +17,7 @@ ;;; Copyright © 2021 Leo Famulari ;;; Copyright © 2021 Pierre Langlois ;;; Copyright © 2021 Calum Irwin +;;; Copyright © 2022 (unmatched parenthesis ;;; ;;; This file is part of GNU Guix. ;;; @@ -187,14 +188,33 @@ (define-public kakoune (substitute* "src/shell_manager.cc" (("if \\(m_shell.empty\\(\\)\\)" line) (string-append "m_shell = \"" (which "sh") - "\";\n " line))) - #t)) + "\";\n " line))))) (delete 'configure) ; no configure script ;; kakoune requires us to be in the src/ directory to build. (add-before 'build 'chdir - (lambda _ (chdir "src") #t))))) + (lambda _ (chdir "src"))) + (add-before 'install 'patch-kakrc + (lambda _ + (chdir "..") + ;; here, we modify the default kakrc to source all the $pkg/share/kak/autoload/*.kak + ;; files automatically. + (substitute* "share/kak/kakrc" + (("echo \"colorscheme default\"" colorscheme-default) + (string-append colorscheme-default " +for dir in $(echo ${GUIX_KAKOUNE_CONFIG_DIRS} | sed 's/:/\\/autoload /g'); do + if [ -d ${dir} ]; then + autoload_directory ${dir} + fi +done +")))))))) (native-inputs (list asciidoc pkg-config ruby)) + (native-search-paths + (list (search-path-specification + ;; kakoune only supports one config dir, so we use this instead, so that we can + ;; modify the default kakrc to source all the autoloads. + (variable "GUIX_KAKOUNE_CONFIG_DIRS") + (files '("share/kak/"))))) (synopsis "Vim-inspired code editor") (description "Kakoune is a code editor heavily inspired by Vim, as such most of its -- 2.34.0