summaryrefslogtreecommitdiff
path: root/guix/ui.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/ui.scm')
-rw-r--r--guix/ui.scm13
1 files changed, 9 insertions, 4 deletions
diff --git a/guix/ui.scm b/guix/ui.scm
index f95c63a81b..04ac43723e 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -34,6 +34,7 @@
#:use-module (guix serialization)
#:use-module ((guix build utils) #:select (mkdir-p))
#:use-module ((guix licenses) #:select (license? license-name))
+ #:use-module ((guix build syscalls) #:select (terminal-columns))
#:use-module (gnu system file-systems)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-11)
@@ -816,8 +817,7 @@ converted to a space; sequences of more than one line break are preserved."
;;;
(define %text-width
- (make-parameter (or (and=> (getenv "WIDTH") string->number)
- 80)))
+ (make-parameter (terminal-columns)))
(set! (@@ (texinfo plain-text) wrap*)
;; XXX: Monkey patch this private procedure to let 'package->recutils'
@@ -855,11 +855,16 @@ followed by \"+ \", which makes for a valid multi-line field value in the
(define* (package->recutils p port #:optional (width (%text-width)))
"Write to PORT a `recutils' record of package P, arranging to fit within
WIDTH columns."
+ (define width*
+ ;; The available number of columns once we've taken into account space for
+ ;; the initial "+ " prefix.
+ (if (> width 2) (- width 2) width))
+
(define (dependencies->recutils packages)
(let ((list (string-join (map package-full-name
(sort packages package<?)) " ")))
(string->recutils
- (fill-paragraph list width
+ (fill-paragraph list width*
(string-length "dependencies: ")))))
(define (package<? p1 p2)
@@ -901,7 +906,7 @@ WIDTH columns."
(format port "~a~2%"
(string->recutils
(string-trim-right
- (parameterize ((%text-width width))
+ (parameterize ((%text-width width*))
(texi->plain-text
(string-append "description: "
(or (and=> (package-description p) P_)