all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "\(unmatched-parenthesis via Guix-patches" via <guix-patches@gnu.org>
To: 54357@debbugs.gnu.org
Cc: "\(unmatched-parenthesis" <paren@disroot.org>
Subject: [bug#54357] [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	[thread overview]
Message-ID: <20220312210940.15397-1-paren@disroot.org> (raw)

* 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 <leo@famulari.name>
 ;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2021 Calum Irwin <calumirwin1@gmail.com>
+;;; Copyright © 2022 (unmatched parenthesis <paren@disroot.org>
 ;;;
 ;;; 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





             reply	other threads:[~2022-03-12 21:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <d119bec222e729f592d4d79f8e9c3a92@disroot.org>
2022-03-12 21:09 ` (unmatched-parenthesis via Guix-patches via [this message]
2022-03-12 22:33   ` [bug#54357] [PATCH] gnu: kakoune: Clean up, and add a search path that makes it possible to package kak plugins in guix. (Plugins incoming soon.) paren--- via Guix-patches via
2022-03-12 22:40   ` [bug#54357] [PATCH] gnu: Add kak-auto-pairs (unmatched-parenthesis via Guix-patches via
2022-03-12 23:20   ` [bug#54357] [PATCH] gnu: Add kak-sudo-write (unmatched-parenthesis via Guix-patches via
2022-03-13 22:16   ` [bug#54357] [PATCH 1/4] gnu: kakoune: Clean up, and add a search path that makes it possible to package kak plugins in guix (unmatched-parenthesis via Guix-patches via
2022-03-13 22:16     ` [bug#54357] [PATCH 2/4] gnu: rust-parinfer: add phases to install the bundled Vim and Kakoune plugins (unmatched-parenthesis via Guix-patches via
2022-03-13 22:16     ` [bug#54357] [PATCH 3/4] gnu: Add kak-auto-pairs (unmatched-parenthesis via Guix-patches via
2022-03-13 22:16     ` [bug#54357] [PATCH 4/4] gnu: Add kak-sudo-write (unmatched-parenthesis via Guix-patches via
2022-03-14 21:56   ` [bug#54357] [PATCH 1/4] gnu: kakoune: Clean up, and add a search path that makes it possible to package kak plugins in guix (unmatched-parenthesis via Guix-patches via
2022-03-14 21:56     ` [bug#54357] [PATCH 2/4] gnu: rust-parinfer: add phases to install the bundled Vim and Kakoune plugins (unmatched-parenthesis via Guix-patches via
2022-03-14 21:56     ` [bug#54357] [PATCH 3/4] gnu: Add kak-auto-pairs (unmatched-parenthesis via Guix-patches via
2022-03-14 21:56     ` [bug#54357] [PATCH 4/4] gnu: Add kak-sudo-write (unmatched-parenthesis via Guix-patches via
2022-06-04  8:23   ` [bug#54357] Calum Irwin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220312210940.15397-1-paren@disroot.org \
    --to=guix-patches@gnu.org \
    --cc=54357@debbugs.gnu.org \
    --cc=paren@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.