all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Arun Isaac <arunisaac@systemreboot.net>
To: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Cc: "Ludovic Courtès" <ludo@gnu.org>, 63802@debbugs.gnu.org
Subject: [bug#63802] [mumi PATCH 0/3] Use consolidated X-Debbugs-Cc header
Date: Mon, 17 Jul 2023 23:14:15 +0100	[thread overview]
Message-ID: <87r0p6qj7s.fsf@systemreboot.net> (raw)
In-Reply-To: <87351ov81r.fsf_-_@gmail.com>


Hi Maxim,

> nitpick: I guess these should be called 'procedures', which seems to be
> the preferred term in Scheme (ironically enough for a functional
> language?  eh!).  CC'ing Ludovic in case they have some thoughts on the
> matter, as I think they were the one originally teaching me that.
>
> If that was just me, intuitively I'd use 'procedure' for something
> involving side effects while 'function' as something taking an input and
> always returning the same output, without side effects (pure function),
> but that doesn't seem to be the prevalent style in the Scheme
> community.

Exactly, that was my intuition too. Maybe, we should break with
tradition! :-) In any case, I have changed all instances of "function"
to "procedure".

>> +            git-send-email-headers
>> +            compose))
>
> I think you've exported 'compose' erroneously here.

Good catch! compose is part of a new "mumi compose" feature I am working
on. I had accidentally committed it. I have removed it from this commit.

Now that you mention it, maybe I should call it compose-email so as to
not conflict with compose from guile core.

>> +(define (git-send-email-headers patch)
>> +  "Print send-email headers for PATCH."
>> +  (let* (;; Compute headers if configured in git config.
>> +         (header-command
>> +          (guard (ex (#t #f))
>> +            (call-with-input-pipe* (list "git" "config" "sendemail.headerCmd")
>> +              get-line)))
>
> Ain't this guard equivalent to '(false-if-exception
> (call-with-input-pipe* ...))' ? I find the later more readable if yes,

Good point! I was not aware of false-if-exception. I have changed to
using it now.

> but: does call-with-input-pipe* raise an exception when git is available
> but 'sendemail.headerCmd' not set, thus exiting with status 1?  I wasn't
> able to find its documentation in the Guile Reference manual.

call-with-input-pipe* and call-with-input-pipe are both defined in
mumi/client.scm. They are not part of guile. The only difference between
them is whether they accept the command as a string or as a list of
arguments---thus, they parallel open-pipe and open-pipe*.

> Otherwise you'd get header-command set to the empty string, which
> seems like it'd be a problem...

call-with-input-pipe* does raise an exception when git is available but
sendemail.headerCmd is not set. I checked. So, this is not a problem.

>> +         (headers
>> +          (if header-command
>> +              (call-with-input-pipe (string-append header-command " " patch)
>
>                   ^ ... here.  Also, why the mixed use of
>                   'call-with-input-pipe*' and 'call-with-input-pipe'?  I'd
>                   stick with the former.

sendemail.headerCmd is only available to us as a string, and not as a
list of arguments. It is quite non-trivial to correctly split the string
back into a list of arguments. That would require correct handling of
quotes like the shell does. So, we use call-with-input-pipe to handle
this case.

But everywhere else (such as when invoking "git config
sendemail.headerCmd"), we prefer to pass commands as a list of
arguments. So, we need call-with-input-pipe*.

I understand it's a bit confusing to have two very similar
functions. But, the only possible compromise is to use
call-with-input-pipe everywhere. Should I make that compromise? WDYT?

Thanks for the review!

Regards,
Arun




  reply	other threads:[~2023-07-17 22:15 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 12:11 [bug#63802] [mumi PATCH 0/3] Use consolidated X-Debbugs-Cc header Arun Isaac
2023-05-30 12:14 ` [bug#63802] [mumi PATCH 1/3] client: Do not pass --add-header to git send-email Arun Isaac
2023-05-30 12:14   ` [bug#63802] [mumi PATCH 2/3] client: Add git-send-email-headers subcommand Arun Isaac
2023-06-05  2:31     ` Maxim Cournoyer
2023-06-08 17:09       ` Arun Isaac
2023-06-08 17:29         ` Arun Isaac
2023-05-30 12:14   ` [bug#63802] [mumi PATCH 3/3] client: Use mumi " Arun Isaac
2023-06-05  2:36     ` Maxim Cournoyer
2023-06-05  2:21   ` [bug#63802] [mumi PATCH 1/3] client: Do not pass --add-header to git send-email Maxim Cournoyer
2023-06-08 17:14 ` [bug#63802] [PATCH 1/3] client: Separate serialize-email-address into a function Arun Isaac
2023-06-08 17:14   ` [bug#63802] [PATCH 2/3] client: Add git-send-email-headers subcommand Arun Isaac
2023-07-16  3:39     ` [bug#63802] [mumi PATCH 0/3] Use consolidated X-Debbugs-Cc header Maxim Cournoyer
2023-07-17 22:14       ` Arun Isaac [this message]
2023-07-18 15:32         ` Maxim Cournoyer
2023-07-19 16:49           ` bug#63802: " Arun Isaac
2023-06-08 17:14   ` [bug#63802] [PATCH 3/3] client: Use mumi git-send-email-headers subcommand Arun Isaac
2023-07-16  4:01     ` [bug#63802] [mumi PATCH 0/3] Use consolidated X-Debbugs-Cc header Maxim Cournoyer
2023-07-17 22:14       ` Arun Isaac
2023-07-16  3:14   ` Maxim Cournoyer
2023-07-17 22:19 ` [bug#63802] [PATCH 1/3] client: Separate serialize-email-address into a procedure Arun Isaac
2023-07-17 22:19   ` [bug#63802] [PATCH 2/3] client: Add git-send-email-headers subcommand Arun Isaac
2023-07-17 22:19   ` [bug#63802] [PATCH 3/3] client: Use mumi " Arun Isaac

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=87r0p6qj7s.fsf@systemreboot.net \
    --to=arunisaac@systemreboot.net \
    --cc=63802@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /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.