[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Return back original implementation for text-config serialization
From: |
Andrew Tropin |
Subject: |
Re: Return back original implementation for text-config serialization |
Date: |
Sun, 09 Jan 2022 20:59:54 +0300 |
On 2022-01-09 13:19, Maxime Devos wrote:
> Andrew Tropin schreef op zo 09-01-2022 om 12:12 [+0300]:
>> [...] There is another less generalized example, which demonstrates
>> how
>> serialization of sway configuration works right now.
>>
>> --8<---------------cut here---------------start------------->8---
>> `((include ,(local-file "./sway/config"))
>> (bindsym $mod+Ctrl+Shift+a exec
>> ,(file-append emacs "/bin/emacsclient") -c --eval
>> "'(eshell)'")
>> (bindsym $mod+Ctrl+Shift+o "[class=\"IceCat\"]" kill)
>> (input * ((xkb_layout us,ru)
>> (xkb_variant dvorak,))))
>> --8<---------------cut here---------------end--------------->8---
>>
>> would yield something like:
>>
>> --8<---------------cut here---------------start------------->8---
>> include /gnu/store/408jwvh6wxxn1j85lj95fniih05gx5xj-config
>> bindsym $mod+Ctrl+Shift+a exec /gnu/store/...-emacsclient -c --eval
>> '(eshell)'
>> bindsym $mod+Ctrl+Shift+o [class="IceCat"] kill
>> input * {
>> xkb_layout us,ru
>> xkb_variant dvorak,
>> }
>> --8<---------------cut here---------------end--------------->8---
>>
>> The new text-config serialization implementation (after fee0bc
>> commit)
>> doesn't support gexps and tries to insert the literal content of the
>> file in place where file-like object was used, which
>>
>> 1. Confuses the users. [...]
>> 2. Looks strange implementation-wise. [...]
>> (mixed-text-file ...
>> "source \" "\n"
>> #~(read-everything-from-file
>> #$(computed-file "unecessary-file-name"
>> #~#$(local-file "blabla.sh"))))
>> when originally it was
>> (mixed-text-file
>> "source \" "\n"
>> (local-file "blabla.sh"))
>
> Can we have (mixed-text-file "source \" "\n" (local-file "blabla.sh"))
> and the sway configuration you quoted? That syntax seems reasonable
> and easy to use to me. But without reintroducing slurp-file-gexp.
>
> Greetings,
> Maxime.
I think we can just rely on something like that:
--8<---------------cut here---------------start------------->8---
#~(call-with-input-file #$(local-file "./files/bashrc")
(@ (ice-9 textual-ports) get-string-all))
--8<---------------cut here---------------end--------------->8---
As I mentioned in reply to Liliana, from my experience it's a rare case,
when we really need to slurp the content of the file, in most cases
include/source and other similar consturctions can do the trick, so it
maybe not necessary to have a helper for this case at all.
WDYT?
BTW, even after reading "Code Staging in GNU Guix" paper, I still not
sure what the problem with slurp-file-gexp (except maybe name :) ).
--
Best regards,
Andrew Tropin
signature.asc
Description: PGP signature
Re: Return back original implementation for text-config serialization, Maxime Devos, 2022/01/09
Re: Return back original implementation for text-config serialization, Maxime Devos, 2022/01/09
- Re: Return back original implementation for text-config serialization,
Andrew Tropin <=
Re: Return back original implementation for text-config serialization, Ludovic Courtès, 2022/01/18
Re: Return back original implementation for text-config serialization, Andrew Tropin, 2022/01/26
Re: Return back original implementation for text-config serialization, Ludovic Courtès, 2022/01/24
Re: Return back original implementation for text-config serialization, Andrew Tropin, 2022/01/26