all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 53909@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#53909] [PATCH 4/4] pull: '--list-generations' pipes its output to the pager.
Date: Wed,  9 Feb 2022 23:17:12 +0100	[thread overview]
Message-ID: <20220209221712.8724-4-ludo@gnu.org> (raw)
In-Reply-To: <20220209221712.8724-1-ludo@gnu.org>

* guix/scripts/pull.scm (process-query): For 'list-generations queries,
use 'with-paginated-output-port'.
(display-news-entry-title): Pass second argument to 'highlight'.
(display-news-entry): Pass second argument to 'dim'.
---
 guix/scripts/pull.scm | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index 707f1f0929..7fe738229b 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -279,7 +279,8 @@ (define title
                   (texi->plain-text title))
 
                 ;; When Texinfo markup is invalid, display it as-is.
-                (const title)))))))
+                (const title)))
+             (or (pager-wrapped-port port) port)))))
 
 (define (display-news-entry entry channel language port)
   "Display ENTRY, a <channel-news-entry> from CHANNEL, in LANGUAGE, a language
@@ -291,7 +292,8 @@ (define commit
     (channel-news-entry-commit entry))
 
   (display-news-entry-title entry language port)
-  (format port (dim (G_ "    commit ~a~%"))
+  (format port (dim (G_ "    commit ~a~%")
+                    (or (pager-wrapped-port port) port))
           (if (supports-hyperlinks?)
               (channel-commit-hyperlink channel commit)
               commit))
@@ -673,14 +675,20 @@ (define (list-generations profile numbers)
              (raise (condition (&profile-not-found-error
                                 (profile profile)))))
             ((not pattern)
-             (list-generations profile (profile-generations profile)))
+             (with-paginated-output-port port
+               (with-output-to-port port
+                 (lambda ()
+                   (list-generations profile (profile-generations profile))))))
             ((matching-generations pattern profile)
              =>
              (match-lambda
                (()
                 (exit 1))
                ((numbers ...)
-                (list-generations profile numbers)))))))
+                (with-paginated-output-port port
+                  (with-output-to-port port
+                    (lambda ()
+                      (list-generations profile numbers))))))))))
     (('display-news)
      (display-news profile))))
 
-- 
2.34.0





  parent reply	other threads:[~2022-02-09 22:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 22:12 [bug#53909] [PATCH 0/4] 'guix pull -l' no longer displays package lists by default Ludovic Courtès
2022-02-09 22:17 ` [bug#53909] [PATCH 1/4] pull: '--list-generations' doesn't list package changes " Ludovic Courtès
2022-02-09 22:17   ` [bug#53909] [PATCH 2/4] ui: 'with-paginated-output-port' gives access to the wrapped port Ludovic Courtès
2022-02-09 22:17   ` [bug#53909] [PATCH 3/4] ui: 'display-generation' uses color when talking to a pager Ludovic Courtès
2022-02-09 22:17   ` Ludovic Courtès [this message]
2022-02-10 17:21   ` [bug#53909] [PATCH 0/4] 'guix pull -l' no longer displays package lists by default zimoun
2022-02-14 14:56     ` bug#53909: " Ludovic Courtès
2022-02-14 17:28       ` [bug#53909] " zimoun
2022-02-10 17:51 ` zimoun
2022-02-14 12:56   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220209221712.8724-4-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=53909@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.