From: EuAndreh <eu@euandre.org>
To: Tobias Geerinckx-Rice <me@tobias.gr>
Cc: help-guix@gnu.org
Subject: Re: How to select git:send-email output in config.scm?
Date: Sat, 08 Aug 2020 17:53:58 -0300 [thread overview]
Message-ID: <87wo28x3ix.fsf@euandre.org> (raw)
In-Reply-To: <87ft8xm29l.fsf@nckx>
Tobias Geerinckx-Rice <me@tobias.gr> writes:
> Indeed, my first mail was too hurried & my longer mail didn't
> address this part at all...
>
> (packages
> (append
> (list (list git "send-email")
> (list git "gui") ; just another example
> foo
> ...)
> (map specification->package
> '("git"
> "bar"
> ...)
>
> PACKAGES takes a list of, well, packages -- *or* (package output)
> sublists! This is not well-documented: it's mentioned in
> gnu/system.scm, but not in the manual under ‘operating-system
> Reference’. I will add it there. Thank you for pointing it out.
Thanks for the explanation, now I could make it work.
> If you want to go one step further, get rid of APPEND, and MAP
> everything: it's not hard to write a procedure similar to
> specification->package+output that returns a list instead of
> multiple values (hint: take a look at DEFINE-VALUES). There might
> well already be one hiding somewhere. I don't know.
>
> For today, at least, I'll leave this as an excercise for the
> reader. :-p
Challenge accepted! :)
I was able to put handle both cases with a single function. I wasn't
able to get rid of map, though. Here's what I got so far:
--8<---------------cut here---------------start------------->8---
(use-modules (gnu)
(srfi srfi-1))
(operating-system
(packages
(append
(map (lambda (spec)
(if (not (string-contains spec ":"))
(specification->package spec)
(let ((spec-pair (string-split spec #\:)))
(list (specification->package (first spec-pair))
(second spec-pair)))))
'("git"
"git:send-email"))
%base-packages))
...))
--8<---------------cut here---------------end--------------->8---
Any suggestions?
next prev parent reply other threads:[~2020-08-08 21:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-08 9:50 How to select git:send-email output in config.scm? EuAndreh
2020-08-08 11:26 ` Tobias Geerinckx-Rice
2020-08-08 14:11 ` EuAndreh
2020-08-08 18:16 ` Tobias Geerinckx-Rice
2020-08-08 20:53 ` EuAndreh [this message]
2020-08-08 11:33 ` Tobias Geerinckx-Rice
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wo28x3ix.fsf@euandre.org \
--to=eu@euandre.org \
--cc=help-guix@gnu.org \
--cc=me@tobias.gr \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).