[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is n
From: |
Taiju HIGASHI |
Subject: |
[bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. |
Date: |
Wed, 8 Jun 2022 19:22:57 +0900 |
* 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@systemreboot.net>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2018 Steve Sprang <scs@stevesprang.com>
+;;; Copyright © 2022 Taiju HIGASHI <higashi@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
- [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed, Taiju HIGASHI, 2022/06/08
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed.,
Taiju HIGASHI <=
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Maxime Devos, 2022/06/08
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/09
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/09
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Maxime Devos, 2022/06/09
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/09
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Maxime Devos, 2022/06/10
- [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed., Taiju HIGASHI, 2022/06/10