Subject: [bug#27675] [PATCH] gnu: kbd: Recursively search $LOADKEYS_KEYMAP_PATH.

From: [email-masked] (Ludovic Courtès)
Date: Mon, 17 Jul 2017 11:20:55 +0200

Hello!

Tobias Geerinckx-Rice <[email-masked]> skribis:

> Fix a regression since commit fd7000fe33d3c4188c241cab97e2b891dd4e1268.
>
> * gnu/packages/linux.scm (kbd)[native-search-path]: Add a double asterisk.
> ---
>  gnu/packages/linux.scm | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
> index c5fed1a7c..700408cc8 100644
> --- a/gnu/packages/linux.scm
> +++ b/gnu/packages/linux.scm
> @@ -1837,7 +1837,10 @@ system.")
>      (native-search-paths
>       (list (search-path-specification
>              (variable "LOADKEYS_KEYMAP_PATH")
> -            (files (list "share/keymaps")))))
> +            ;; Append ‘/**’ to recursively search all directories.  One can then
> +            ;; run (for example) ‘loadkeys en-latin9’ instead of having to find
> +            ;; and type ‘i386/colemak/en-latin9’ on an unfamiliar keyboard.
> +            (files (list "share/keymaps/**")))))

That works if you copy paste the suggested search path in a shell, but
not if we pass it to ‘evaluate-search-paths’ from (guix search-paths)
(it doesn’t recognize the ** syntax.)

What about:

  (search-path-specification
    (variable "LOADKEYS_KEYMAP_PATH")
    (files (list "share/keymaps"))
    (file-type 'regular)
    (file-pattern ".*"))  ;or "\\.map"?

That gives this:

--8<---------------cut here---------------start------------->8---
scheme@(guix search-paths)> (search-path-specification
    (variable "LOADKEYS_KEYMAP_PATH")
    (files (list "share/keymaps"))
    (file-type 'regular)
    (file-pattern ".*"))
$8 = #<<search-path-specification> variable: "LOADKEYS_KEYMAP_PATH" files: ("share/keymaps") separator: ":" file-type: regular file-pattern: ".*">
scheme@(guix search-paths)> (evaluate-search-paths (list $8) (list "/run/current-system/profile"))
$9 = ((#<<search-path-specification> variable: "LOADKEYS_KEYMAP_PATH" files: ("share/keymaps") separator: ":" file-type: regular file-pattern: ".*"> . "/run/current-system/profile/share/keymaps/amiga/amiga-de.map.gz:/run/current-system/profile/share/keymaps/amiga/amiga-us.map.gz:/run/current-system/profile/share/keymaps/atari/atari-de.map.gz:/run/current-system/profile/share/keymaps/atari/atari-se.map.gz:/run/current-system/profile/share/keymaps/atari/atari-uk-falcon.map.gz:/run/current-system/profile/share/keymaps/atari/atari-us.map.gz:/run/current-system/profile/share/key…
--8<---------------cut here---------------end--------------->8---

Is this correct?

Ludo’.