(let ((body (or (assoc-ref body language)
(assoc-ref body (%default-message-language))
"")))
- (format port " ~a~%"
+ (format port "~a~%"
(indented-string
(parameterize ((%text-width (- (%text-width) 4)))
(string-trim-right
;;; Queries.
;;;
-(define (indented-string str indent)
- "Return STR with each newline preceded by IDENT spaces."
- (define indent-string
- (make-list indent #\space))
-
- (list->string
- (string-fold-right (lambda (chr result)
- (if (eqv? chr #\newline)
- (cons chr (append indent-string result))
- (cons chr result)))
- '()
- str)))
-
(define profile-package-alist
(mlambda (profile)
"Return a name/version alist representing the packages in PROFILE."
(define (pretty str column)
(indented-string (fill-paragraph str (- (%text-width) 4)
column)
- 4))
+ 4 #:initial-indent? #f))
(define concise/max-item-count
;; Maximum number of items to display when CONCISE? is true.
read/eval
read/eval-package-expression
check-available-space
+ indented-string
fill-paragraph
%text-width
texi->plain-text
(lambda ()
body ...)))))
+(define* (indented-string str indent
+ #:key (initial-indent? #t))
+ "Return STR with each newline preceded by IDENT spaces. When
+INITIAL-INDENT? is true, the first line is also indented."
+ (define indent-string
+ (make-list indent #\space))
+
+ (list->string
+ (string-fold-right (lambda (chr result)
+ (if (eqv? chr #\newline)
+ (cons chr (append indent-string result))
+ (cons chr result)))
+ '()
+ (if initial-indent?
+ (string-append (list->string indent-string) str)
+ str))))
+
(define* (fill-paragraph str width #:optional (column 0))
"Fill STR such that each line contains at most WIDTH characters, assuming
that the first character is at COLUMN.