guix-devel
[Top][All Lists]
Advanced

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

Re: fish: how to change the vendor_* directories


From: ng0
Subject: Re: fish: how to change the vendor_* directories
Date: Sat, 6 May 2017 08:30:37 +0000

ng0 transcribed 0.7K bytes:
> Today I noticed that my fish completions don't work if you install them from
> within guix.
> They do work if they are in one of the scanned directories, which includes 
> and used to be
> ~/.config/fish/completions/ where I symlinked my developer copy to.
> So I just learned about ${PREFIX}/share/fish/vendor_functions.d being one of 
> the directories
> which is intended for third party addons.
> We can not change fish to pick up 
> $HOME/.guix-profile/share/fish/vendor_functions.d, at least
> not from what I tried in 5 minutes. Vim was easier, you are able to set a 
> path manually.
> Any suggestions on how we can hack this? Maybe simply extend the SEARCH PATH?

Okay, I tried this:

address@hidden ~/s/g/guix> git diff
diff --git a/gnu/packages/shells.scm b/gnu/packages/shells.scm
index 6f06acfa4..2b0199e12 100644
--- a/gnu/packages/shells.scm
+++ b/gnu/packages/shells.scm
@@ -138,6 +138,10 @@ direct descendant of NetBSD's Almquist Shell 
(@command{ash}).")
              (substitute* "share/functions/__fish_print_help.fish"
                (("nroff") (which "nroff")))
              #t)))))
+    (native-search-paths
+     (list (search-path-specification
+            (variable "fish_function_path")
+            (files '("share/fish/vendor_functions.d")))))
     (synopsis "The friendly interactive shell")
     (description
      "Fish (friendly interactive shell) is a shell focused on interactive use,

this leads to (at guix package -i fish):

The following environment variable definitions may be needed:
   export 
fish_function_path="/home/user/.guix-profile/share/fish/vendor_functions.d${fish_function_path:+:}$fish_function_path"

where it should be:

set fish_function_path foo foo foo foo ourdir

in your fish config. So we basically must output the default (see below)
and prepend the native-search-path we added.
Because fish has a different syntax than bash it won't work like output
at the end, but of course fish (if you don't change any defaults and your
user shell is bash) inherits variables of bash. So this might work in
this special case but not the case where fish is your system shell, which
I'd honestly not recommend with guix. Or I would recommend it, so that we
can see what errors could be produced. I simply start fish from bash.

file: "share/config.fish" in FISH source:

if not set -q fish_function_path
set fish_function_path $configdir/fish/functions $__fish_sysconfdir/functions 
$__extra_functionsdir $__fish_datadir/functions

file: "configure.ac":
…
[extra_completionsdir=$withval],
            [extra_completionsdir='${datadir}/fish/vendor_completions.d'])

AC_SUBST(extra_functionsdir)
            [extra_functionsdir=$withval],
            [extra_functionsdir='${datadir}/fish/vendor_functions.d'])
…

at the moment this leads to:

address@hidden ~]$ fish
address@hidden ~> echo $fish_function_path
/home/user/.config/fish/functions /etc/fish/functions 
/gnu/store/3bmrbk8c2a03y2b31gcv67n0bh3div7z-fish-2.5.0/share/fish/vendor_functions.d
 /gnu/store/3bmrbk8c2a03y2b31gcv67n0bh3div7z-fish-2.5.0/share/fish/functions

We could simply tell the users of this shell to update this manually OR hack it 
*somehow*
into the defaults of fish.

I'd prefer a solution with native-search-patch.
-- 
https://pragmatique.xyz
PGP: https://people.pragmatique.xyz/ng0/



reply via email to

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