From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 08 11:09:27 2022 Received: (at 55845) by debbugs.gnu.org; 8 Jun 2022 15:09:28 +0000 Received: from localhost ([127.0.0.1]:43982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyxJH-0006Ni-Je for submit@debbugs.gnu.org; Wed, 08 Jun 2022 11:09:27 -0400 Received: from mail-pj1-f47.google.com ([209.85.216.47]:54107) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nyxJF-0006NU-H4 for 55845@debbugs.gnu.org; Wed, 08 Jun 2022 11:09:26 -0400 Received: by mail-pj1-f47.google.com with SMTP id a10so18841638pju.3 for <55845@debbugs.gnu.org>; Wed, 08 Jun 2022 08:09:25 -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:references:date:in-reply-to:message-id :user-agent:mime-version; bh=D84by1sZDsvs54XAGDpfLyQuUma/2NsiOPYV9yhoGgU=; b=GlXp3MhyyS0LdUvAOS18wMI/b6jn854LHSTe+MvhyVOklq5zVhxSY20mtEKzyXyfP8 RVsrs0ze03chZZou9hKTc3Bc0/kZLSM5uDwouNQugB3jNmGH/fIE/odmYRBxv/BlMaJ9 mLmXEeWTcW3/COQEeE716z+M95MlD+hi5WPP13X16D77f7/Ew0IINOV8GPPhK/in0uI6 4L3Ylna+z1LZCMBn6gpE+BGgIDeUmo2CXaRUZPMwAhade0kNU+E+EbApQY6bovgMPhnU qYETgcPwplgiBoFjBF3O6aCstesOc0x9SU0u23P+71rzBDkCxwrl3eRsSdh7Dluzc+/1 50kg== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=D84by1sZDsvs54XAGDpfLyQuUma/2NsiOPYV9yhoGgU=; b=bJI5g1he7WdeC6WFdDy72m86xbOTt2dtlwPkMUbju50iR9C2sPMyUqHTvs/QyE/YEr PFF/Lq2YMOsv+3VGviWfYEhty6UqsPkQ+RrfhGJwTX0Twki9ZZ5oxLZ/OimXpdB2WV5c mz/Z5y8WqDGAQ4DdyPNLkOxZFXQZ/3h7kADxK7r6SuqMFU0T8T9YutpFXfeyQue0x5J6 VBKV5B2p5+AtAdDQHInihCZMDTzcIETmjiTsMxdZPTnrl+nSawH139EM7ne/Hrw8YPyM GuSgHoMyhSg12kDsFpAkrs/6n4H3Cu28Np++qoI1xt3tsHOK1JbdPVu2HAtdcOtmHvmH FZzQ== X-Gm-Message-State: AOAM532Du3mrCjgNNeq2/TFi+QKVZYjGucX8GF/1/ou7qLl7P1J5iHkQ m07KvMqv/X8TV29SAK2R5QDDiPSLDNoVVWGl X-Google-Smtp-Source: ABdhPJxP10xTy5wImRWwwZvnpuwqLNGp8U4Dfr6x7zpTiBb1EN546BLEzHgWM6zC3OxDBFFVnIS8ZA== X-Received: by 2002:a17:90a:4414:b0:1df:9b8f:c3cc with SMTP id s20-20020a17090a441400b001df9b8fc3ccmr72779500pjg.56.1654700959621; Wed, 08 Jun 2022 08:09:19 -0700 (PDT) Received: from Taix ([240b:253:ec40:2400:b7d1:436e:2d61:e925]) by smtp.gmail.com with ESMTPSA id m6-20020a1709026bc600b0016370e1af6bsm12073943plt.128.2022.06.08.08.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 08:09:19 -0700 (PDT) From: Taiju HIGASHI To: Tobias Geerinckx-Rice Subject: Re: [bug#55845] [PATCH 0/1] Improve pager selection logic when less is not installed References: <20220608102124.14865-1-higashi@taiju.info> <87wndrwc5m@nckx> <8735gf47ul.fsf@taiju.info> <87k09rw74q@nckx> Date: Thu, 09 Jun 2022 00:09:16 +0900 In-Reply-To: <87k09rw74q@nckx> (Tobias Geerinckx-Rice's message of "Wed, 08 Jun 2022 16:22:08 +0200") Message-ID: <87sfof19b7.fsf@taiju.info> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-2022-jp X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 55845 Cc: 55845@debbugs.gnu.org, guix-patches@gnu.org 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 (-) Hi Tobias, Thank you kindly for your detailed explanation. Tobias Geerinckx-Rice writes: > Hi again, > > Taiju HIGASHI 写道: >> I understand that I can delay the evaluation timing if I make it a >> procedure, but is my understanding correct that the number of calls >> will >> remain the same because it will be evaluated each time the >> `call-with-paginated-output-port` procedure is called? > > Previously, it would have been evaluated even if > call-with-paginated-output-port was never called at all. > > As for the >0 calls case: yes… but when do we expect > call-with-paginated-output-port to be called more than once per run? > > The use case for this code is to do something, then display it in a > pager and exit. I think calling it multiple times in one run would > imply bad UX. > > Do I misunderstand? No, you don't. As you said, my implementation was a bad idea, as call-with-paginated-output-port is executed even when it is not needed. It seems unlikely that call-with-paginated-output-port will be called more than once in a single process. I did not have enough insight. >> I agree with your point that it would be better to make it a >> procedure, >> as it would be more eco-friendly to not have to evaluate when >> GUIX_PAGER >> or PAGER is specified. > > I wish the rest of Guix were so efficient that it mattered :-) > > [/me is waiting for ‘guix pull’ as I reply to multiple mails, on > battery…] > > Regardless, not calling a procedure at all is even more efficient and > IMO more readable here. I agree. >> You mean that the $PATH lookup in open-pipe can be suppressed? > > Yes. OPEN-PIPE* won't need to stat $PATH at all if we give it > "/run/current-system/profile/bin/less" instead of "less". > > (It's not relevant to the above, but my previously reply mistakenly > mentioned a shell ― there is no shell involved with OPEN-PIPE*, only > with OPEN-PIPE. Sorry.) No problem. I'm sorry I'm the one who asked a ton of questions. >> I will just write what you have told me, but may I continue to >> modify >> the patch? > > Of course! Curious how, though. I have also received a response from Maxime and plan to include the following information. (define (find-available-pager) "Returns the program name or path of an available pager. If neither less nor more is installed, return an empty string so that call-with-paginated-output-port will not call pager." (or (getenv "GUIX_PAGER") (getenv "PAGER") (which "less") (which "more") "" ;; Returns an empty string so that call-with-paginated-output-port does not call pager. )) (define* (call-with-paginated-output-port proc #:key (less-options "FrX")) (let ((pager-command-line (find-available-pager))) ... However, I can't submit the v2 patch yet because I don't know how to implement the integration test. Thanks, -- Taiju