GNU bug report logs -
#55845
[PATCH 0/1] Improve pager selection logic when less is not installed
Previous Next
Reported by: Taiju HIGASHI <higashi <at> taiju.info>
Date: Wed, 8 Jun 2022 10:22:02 UTC
Severity: normal
Tags: patch
Done: Ludovic Courtès <ludo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
* guix/ui.scm (available-pager): New variable. Holds available pagers.
(call-with-paginated-output-port): Get an alternative program from the
available-pager variable when the environment variable is not set.
---
guix/ui.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/guix/ui.scm b/guix/ui.scm
index cb68a07c6c..22169a7eb8 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -17,6 +17,7 @@
;;; Copyright © 2020 Arun Isaac <arunisaac <at> systemreboot.net>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
;;; Copyright © 2018 Steve Sprang <scs <at> stevesprang.com>
+;;; Copyright © 2022 Taiju HIGASHI <higashi <at> taiju.info>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1672,11 +1673,18 @@ (define* (pager-wrapped-port #:optional (port (current-output-port)))
(_
#f)))
+(define available-pager
+ (if (which "less")
+ "less"
+ (if (which "more")
+ "more"
+ #f)))
+
(define* (call-with-paginated-output-port proc
#:key (less-options "FrX"))
(let ((pager-command-line (or (getenv "GUIX_PAGER")
(getenv "PAGER")
- "less")))
+ available-pager)))
;; Setting PAGER to the empty string conventionally disables paging.
(if (and (not (string-null? pager-command-line))
(isatty?* (current-output-port)))
--
2.36.1
This bug report was last modified 2 years and 338 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.