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

From: Maxime Devos <[email-masked]>
Date: Wed, 08 Jun 2022 15:18:20 +0200

Taiju HIGASHI schreef op wo 08-06-2022 om 19:22 [+0900]:
> +(define available-pager
> +  (if (which "less")
> +      "less"
> +      (if (which "more")
> +          "more"
> +          #f)))

Can be simplified to something like,:

(define (find-available-pager)
  "[appropriate docstring]"
  (or (getenv "GUIX_PAGER") ;; <-- simplify 'if' chains by using 'or'
      (getenv "PAGER")
      (which "less")
      (which "more")
      ;; <--- TODO: how to handle no pager being found?
      ))

and

   (let ((pager-command-line (available-pager)))
     [...])

I've thunked find-available-pager here, such that call-with-paginated-
output-port respects the $PATH that is set before call-with-paginated-
output-port instead of the $PATH from when "guix ui" was loaded?

Ideally there would be some regression tests as well.

Greetings,
Maxime