From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CB3uAJR6oGJTNQEAbAwnHQ (envelope-from ) for ; Wed, 08 Jun 2022 12:31:48 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id KDfNAJR6oGLIzwAAauVa8A (envelope-from ) for ; Wed, 08 Jun 2022 12:31:48 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id DBCD9160FF for ; Wed, 8 Jun 2022 12:31:46 +0200 (CEST) Received: from localhost ([::1]:55050 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nysyW-0001Ye-8d for larch@yhetil.org; Wed, 08 Jun 2022 06:31:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nysr4-0007pK-0F for guix-patches@gnu.org; Wed, 08 Jun 2022 06:24:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:48637) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nysr3-0006uQ-Nw for guix-patches@gnu.org; Wed, 08 Jun 2022 06:24:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nysr3-00074Y-K8 for guix-patches@gnu.org; Wed, 08 Jun 2022 06:24:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#55845] [PATCH 1/1] ui: Improve pager selection logic when less is not installed. References: <20220608102124.14865-1-higashi@taiju.info> In-Reply-To: <20220608102124.14865-1-higashi@taiju.info> Resent-From: Taiju HIGASHI Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 08 Jun 2022 10:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55845 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 55845@debbugs.gnu.org Cc: Taiju HIGASHI Received: via spool by 55845-submit@debbugs.gnu.org id=B55845.165468379127109 (code B ref 55845); Wed, 08 Jun 2022 10:24:01 +0000 Received: (at 55845) by debbugs.gnu.org; 8 Jun 2022 10:23:11 +0000 Received: from localhost ([127.0.0.1]:42528 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nysqF-00073A-In for submit@debbugs.gnu.org; Wed, 08 Jun 2022 06:23:11 -0400 Received: from mail-pl1-f173.google.com ([209.85.214.173]:44718) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nysqD-00072y-TO for 55845@debbugs.gnu.org; Wed, 08 Jun 2022 06:23:10 -0400 Received: by mail-pl1-f173.google.com with SMTP id h1so17227345plf.11 for <55845@debbugs.gnu.org>; Wed, 08 Jun 2022 03:23:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=taiju-info.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KaL2oAv1XnIetV/Xd4/sRxLu2VlCQnQodKvKAgx53Uk=; b=ah/uIf+pmaUDos3K+Q6cMAnShErdrEWALX1GN5VsRd8PMqaCBlA85vVuV4MxZ2UrqU XlQnnbSEDjoXfaz167+xR3gXGniYDl/HG01SZIUTxLcrc3QPQ4iuclx7bva8Tt6kCb/3 ibJm8/YOTerHQB1UMQELjk9zDuxrvY8nl83/ruRMNNCQCIfYBpwxqs5vJZ7bF8snkWlT V45dTK18JEFVfGTn6gmaPz8itEbyeMNmkCy2n00444B+38m0QnLXmdYlzwvyk1V8+ivR wu36qivZ/h2Dhwtm6anG9tXum3V2F3AJPhqASiR7LHRZGxG6eoZAWORzuJ76gOkzq9SI q39g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=KaL2oAv1XnIetV/Xd4/sRxLu2VlCQnQodKvKAgx53Uk=; b=BBUEaDS7cyCW6A3iwwuZWKQAyOG95YvyAPf+mtZfJLbJ48uSCMNY9p8Gw3e/Wfwmfb JinXOVW5epBl2nyIBXHxwthRRXElCw3MyZuprz1co5Q3fZm6cuS31ltRn2RRHw1vOgzk yMcqIe7I/IvEE+YFc+KyJofSPAQoKzZJN+8hVOfgvfE6OwTKxCrE1ziiuDKe7wuJQ0nl uxJu67FT4WLQSsK74N+dctw5cT5P4aHH6YJPvphmB2JASBy6Dydakue1knPw+8lM3m+Q Jn3rpZ6//8FoTLDKJEmqBsk6/qoFlJuOnbaqrn36nwfZxp26FzeY3bJs6Eoz+TKv6P7x MB4g== X-Gm-Message-State: AOAM53225InEtn7A5+3FTtKOVLGooxkZHsPWj822HB0Mrcy9IZIhZ06K bwQIHuY/pWbuu1EGjbcVjdL5O6PqqApXJTcN X-Google-Smtp-Source: ABdhPJziGPnf6AGDmoY7BopEcq6FOBi/wFQb68n0phnI3k4+6SM2FzV7rXMJkqVA9UzknSsCckWEug== X-Received: by 2002:a17:903:41d0:b0:167:68a7:c3d with SMTP id u16-20020a17090341d000b0016768a70c3dmr20528353ple.161.1654683781931; Wed, 08 Jun 2022 03:23:01 -0700 (PDT) Received: from Taix.flets-west.jp ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id i69-20020a628748000000b0051c758a3957sm88492pfe.149.2022.06.08.03.23.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 03:23:01 -0700 (PDT) From: Taiju HIGASHI Date: Wed, 8 Jun 2022 19:22:57 +0900 Message-Id: <20220608102257.15042-1-higashi@taiju.info> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1654684307; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=KaL2oAv1XnIetV/Xd4/sRxLu2VlCQnQodKvKAgx53Uk=; b=WxY3tpNM15VYJGFh08WDXPq3FEPe0j/paZbPmWTovkIQMn+1cy+lQG4/o7ubXWdOIN21CL lWVrtiP0cEyFMWDuEhtX6HVmEKXAmSL9jPe4uslzXh344ZdB0qU48kinvIXeTe77crCrJA seNirKzpcellkqoPOyHo5GC728Gl5MlEpBziJYSrZiYrNRdaMhqtqlOe8Kq3QcKQwjHitk 2ruMeoR3RodL18tFsaJ1DTssV7Tz0OEBL/0wQJcGZcBMOe47LDN7sQ0aGTSaqQ3bcS2igP tzS4+IKuksTjb/AYGzj3MBZ7QtgV7hcaMa+RU2R21LMkcQF8Zb7wSgkhPs4QnA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1654684307; a=rsa-sha256; cv=none; b=gUL/K6CbZB9RX2/IdxG1cZ/uGs+sch2bBS6dOp1epnYKSdSq6LkK4ytf1YQKUtdf1mpwJ9 ChoqK7ZJHRyGfmVOymdI2vGv9akOGRnWwdMqTuMfFOYMf7F+XaQwpck+QLNvzQ8B+nf7KG e6hNMPVZXq5LKbPhzgvW5R/Nw4DYjr/vkqWGwIg1S0+/lK4HedQKmWf3Li0Qn3ofWzwXwk X+ledmiWi0vAeKaV13ZPOxgOwR2pHTkiASSY5eEdFpyLJp4S/swcpMpTXZh2AHM8LS2u4G 5cxKHukYlroM3Bfi6m1xDWw1VCSV9K2vC0qCn3gSTAUM8EXjAce2WratVALmJg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=taiju-info.20210112.gappssmtp.com header.s=20210112 header.b="ah/uIf+p"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 3.50 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=taiju-info.20210112.gappssmtp.com header.s=20210112 header.b="ah/uIf+p"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: DBCD9160FF X-Spam-Score: 3.50 X-Migadu-Scanner: scn1.migadu.com X-TUID: eoxR/TDMSVaD * 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 ;;; Copyright © 2020 Maxim Cournoyer ;;; Copyright © 2018 Steve Sprang +;;; Copyright © 2022 Taiju HIGASHI ;;; ;;; 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