unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Taiju HIGASHI <higashi@taiju.info>
To: Tobias Geerinckx-Rice <me@tobias.gr>
Cc: 55845@debbugs.gnu.org
Subject: [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed
Date: Thu, 09 Jun 2022 00:09:16 +0900	[thread overview]
Message-ID: <87sfof19b7.fsf@taiju.info> (raw)
In-Reply-To: <87k09rw74q@nckx> (Tobias Geerinckx-Rice's message of "Wed, 08 Jun 2022 16:22:08 +0200")

Hi Tobias,

Thank you kindly for your detailed explanation.

Tobias Geerinckx-Rice <me@tobias.gr> writes:

> 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?

No, you don't.
As you said, my implementation was a bad idea, as
call-with-paginated-output-port is executed even when it is not needed.
It seems unlikely that call-with-paginated-output-port will be called
more than once in a single process. I did not have enough insight.

>> 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.

I agree.

>> 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.)

No problem. I'm sorry I'm the one who asked a ton of questions.

>> I will just write what you have told me, but may I continue to
>> modify
>> the patch?
>
> Of course!  Curious how, though.

I have also received a response from Maxime and plan to include the
following information.

(define (find-available-pager)
  "Returns the program name or path of an available pager.
If neither less nor more is installed, return an empty string so that
call-with-paginated-output-port will not call pager."
  (or (getenv "GUIX_PAGER")
      (getenv "PAGER")
      (which "less")
      (which "more")
      "" ;; Returns an empty string so that call-with-paginated-output-port does not call pager.
      ))

(define* (call-with-paginated-output-port proc
                                          #:key (less-options "FrX"))
  (let ((pager-command-line (find-available-pager)))
...

However, I can't submit the v2 patch yet because I don't know how to
implement the integration test.

Thanks,
-- 
Taiju




      reply	other threads:[~2022-06-08 15:22 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-08 10:21 [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed Taiju HIGASHI
2022-06-08 10:22 ` [bug#55845] [PATCH 1/1] ui: " Taiju HIGASHI
2022-06-08 13:18   ` Maxime Devos
     [not found]     ` <87leu72sbo.fsf@taiju.info>
2022-06-08 15:08       ` Maxime Devos
2022-06-08 15:17         ` Taiju HIGASHI
2022-06-08 16:46           ` Maxime Devos
2022-06-09  9:52         ` Taiju HIGASHI
2022-06-09 10:23           ` Taiju HIGASHI
2022-06-09 19:43             ` Maxime Devos
2022-06-10  0:39               ` Taiju HIGASHI
2022-06-10  7:47                 ` Maxime Devos
2022-06-10  8:40                   ` Taiju HIGASHI
2022-06-10 15:08                     ` Maxime Devos
2022-06-11 11:26                       ` Taiju HIGASHI
2022-06-14 23:58                         ` Taiju HIGASHI
2022-06-15  8:02                           ` Maxime Devos
2022-06-16 21:43                         ` [bug#55845] [PATCH 0/1] " Ludovic Courtès
2022-06-17  0:38                           ` Taiju HIGASHI
2022-06-17 12:39                             ` Ludovic Courtès
2022-06-17 13:36                               ` Taiju HIGASHI
2022-06-17 15:12                                 ` Ludovic Courtès
2022-06-18 14:11                                   ` Taiju HIGASHI
2022-06-10  0:55               ` [bug#55845] [PATCH 1/1] ui: " Taiju HIGASHI
2022-06-10  7:37                 ` Maxime Devos
2022-06-10  8:52                   ` Taiju HIGASHI
2022-06-08 12:14 ` [bug#55845] [PATCH 0/1] " Tobias Geerinckx-Rice via Guix-patches via
2022-06-08 13:12   ` Taiju HIGASHI
2022-06-08 14:22     ` Tobias Geerinckx-Rice via Guix-patches via
2022-06-08 15:09       ` Taiju HIGASHI [this message]

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=87sfof19b7.fsf@taiju.info \
    --to=higashi@taiju.info \
    --cc=55845@debbugs.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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

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).