From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 06:23:11 2022 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 To: 55845@debbugs.gnu.org Subject: [PATCH 1/1] ui: Improve pager selection logic when less is not installed. 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-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: Taiju HIGASHI X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) * 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