Subject: Re: [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed

From: Tobias Geerinckx-Rice <[email-masked]>
Date: Wed, 08 Jun 2022 16:22:08 +0200

Hi again,

Taiju HIGASHI 写道：
> I understand that I can delay the evaluation timing if I make it 
> a
> procedure, but is my understanding correct that the number of 
> calls will
> remain the same because it will be evaluated each time the
> `call-with-paginated-output-port` procedure is called?

Previously, it would have been evaluated even if 
call-with-paginated-output-port was never called at all.

As for the >0 calls case: yes… but when do we expect 
call-with-paginated-output-port to be called more than once per 
run?

The use case for this code is to do something, then display it in 
a pager and exit.  I think calling it multiple times in one run 
would imply bad UX.

Do I misunderstand?

> I agree with your point that it would be better to make it a 
> procedure,
> as it would be more eco-friendly to not have to evaluate when 
> GUIX_PAGER
> or PAGER is specified.

I wish the rest of Guix were so efficient that it mattered :-)

[/me is waiting for ‘guix pull’ as I reply to multiple mails, on 
battery…]

Regardless, not calling a procedure at all is even more efficient 
and IMO more readable here.

> You mean that the $PATH lookup in open-pipe can be suppressed?

Yes.  OPEN-PIPE* won't need to stat $PATH at all if we give it 
"/run/current-system/profile/bin/less" instead of "less".

(It's not relevant to the above, but my previously reply 
mistakenly mentioned a shell — there is no shell involved with 
OPEN-PIPE*, only with OPEN-PIPE.  Sorry.)

> I will just write what you have told me, but may I continue to 
> modify
> the patch?

Of course!  Curious how, though.

Kind regards,

T G-R