guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/05: ui: Restore line wrapping for 'package->recutils'.


From: guix-commits
Subject: 01/05: ui: Restore line wrapping for 'package->recutils'.
Date: Wed, 11 Mar 2020 13:42:19 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 3c1ea8dcef3342dba9fb1456effb31eb106a189a
Author: Ludovic Courtès <address@hidden>
AuthorDate: Wed Mar 11 16:07:04 2020 +0100

    ui: Restore line wrapping for 'package->recutils'.
    
    Fixes a regression introduced when switching to Guile 3.0.0 whereby
    monkey-patching 'wrap*' wouldn't have any effects due to inlining.
    
    * guix/ui.scm (%text-width): Define in terms of the '*line-width*' fluid
    when it's defined.
    <top level>: Set (@@ (texinfo plain-text) wrap*) only when
    '*line-width*' is undefined.
---
 guix/ui.scm | 27 +++++++++++++++++----------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index fbe2b70..6f1ca9c 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1218,16 +1218,23 @@ converted to a space; sequences of more than one line 
break are preserved."
 ;;;
 
 (define %text-width
-  (make-parameter (terminal-columns)))
-
-(set! (@@ (texinfo plain-text) wrap*)
-      ;; XXX: Monkey patch this private procedure to let 'package->recutils'
-      ;; parameterize the fill of description field correctly.
-      (lambda strings
-        (let ((indent (fluid-ref (@@ (texinfo plain-text) *indent*))))
-          (fill-string (string-concatenate strings)
-                       #:line-width (%text-width) #:initial-indent indent
-                       #:subsequent-indent indent))))
+  ;; '*line-width*' was introduced in Guile 2.2.7/3.0.1.  On older versions of
+  ;; Guile, monkey-patch 'wrap*' below.
+  (if (defined? '*line-width*)
+      (let ((parameter (fluid->parameter *line-width*)))
+        (parameter (terminal-columns))
+        parameter)
+      (make-parameter (terminal-columns))))
+
+(unless (defined? '*line-width*)                  ;Guile < 2.2.7
+  (set! (@@ (texinfo plain-text) wrap*)
+    ;; XXX: Monkey patch this private procedure to let 'package->recutils'
+    ;; parameterize the fill of description field correctly.
+    (lambda strings
+      (let ((indent (fluid-ref (@@ (texinfo plain-text) *indent*))))
+        (fill-string (string-concatenate strings)
+                     #:line-width (%text-width) #:initial-indent indent
+                     #:subsequent-indent indent)))))
 
 (define (texi->plain-text str)
   "Return a plain-text representation of texinfo fragment STR."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]